class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: F = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: C = None
        self.txt = txt

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

d.t = a
d.u = a
d.x = l
d.z = n
n.x = h
n.q = d
l.p = h
l.u = d
l.z = b
l.v = a
l.q = a
h.p = d
h.t = l
f.o = m
f.w = h
f.v = b
a.o = n
a.v = l
b.p = h
b.u = d
b.z = l
b.v = a
b.q = a
m.x = h
m.q = d
assert a.o.x.p.x.u.z.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: F = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: D = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: C = None
        self.txt = txt

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

d.t = a
d.u = a
d.x = l
d.z = n
n.x = h
n.q = d
l.p = h
l.u = d
l.z = b
l.v = a
l.q = a
h.p = d
h.t = l
f.o = m
f.w = h
f.v = b
a.o = n
a.v = l
b.p = h
b.u = d
b.z = l
b.v = a
b.q = a
m.x = h
m.q = d
assert a.o.x.p.x.u.z.x.t.txt == "l"