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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: D = None
        self.t: F = None
        self.u: D = None
        self.o: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: E = None
        self.y: C = None
        self.q: F = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: D = None
        self.t: D = None
        self.z: B = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

n.z = m
n.q = b
n.v = e
f.t = h
f.q = n
h.x = b
h.r = k
h.u = k
h.t = e
h.o = e
m.u = k
m.x = b
m.z = b
m.y = d
m.q = e
b.p = h
b.w = m
b.t = k
b.z = f
b.u = d
e.z = d
d.x = b
d.r = m
d.t = e
d.o = e
d.u = k
k.u = m
k.x = b
k.z = b
k.y = d
k.q = e
assert h.x.t.u.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: E = None
        self.v: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: D = None
        self.t: F = None
        self.u: D = None
        self.o: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: E = None
        self.y: C = None
        self.q: F = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: D = None
        self.t: D = None
        self.z: B = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

n.z = m
n.q = b
n.v = e
f.t = h
f.q = n
h.x = b
h.r = k
h.u = k
h.t = e
h.o = e
m.u = k
m.x = b
m.z = b
m.y = d
m.q = e
b.p = h
b.w = m
b.t = k
b.z = f
b.u = d
e.z = d
d.x = b
d.r = m
d.t = e
d.o = e
d.u = k
k.u = m
k.x = b
k.z = b
k.y = d
k.q = e
assert h.x.t.u.q.z.txt == "d"