class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: E = None
        self.r: B = None
        self.o: A = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: F = None
        self.w: F = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.w: A = None
        self.r: A = None
        self.s: A = None
        self.txt = txt

f = A("f")
g = B("g")
i = C("i")
h = D("h")
b = E("b")
d = F("d")
k = B("k")
m = E("m")
e = D("e")
c = A("c")

f.z = b
g.x = c
i.q = c
i.o = c
i.z = b
i.r = g
i.s = m
h.z = k
h.x = d
h.w = d
h.t = d
b.z = i
b.x = g
d.z = g
d.q = i
d.w = c
d.r = f
d.s = f
k.x = f
m.z = i
m.x = k
e.z = k
e.x = d
e.w = d
e.t = d
c.z = m
assert f.z.z.z.z.o.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: E = None
        self.r: B = None
        self.o: A = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: F = None
        self.w: F = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.w: A = None
        self.r: A = None
        self.s: A = None
        self.txt = txt

f = A("f")
g = B("g")
i = C("i")
h = D("h")
b = E("b")
d = F("d")
k = B("k")
m = E("m")
e = D("e")
c = A("c")

f.z = b
g.x = c
i.q = c
i.o = c
i.z = b
i.r = g
i.s = m
h.z = k
h.x = d
h.w = d
h.t = d
b.z = i
b.x = g
d.z = g
d.q = i
d.w = c
d.r = f
d.s = f
k.x = f
m.z = i
m.x = k
e.z = k
e.x = d
e.w = d
e.t = d
c.z = m
assert f.z.z.z.z.o.z.z.z.txt == "b"