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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

b = A("b")
d = B("d")
j = C("j")
i = D("i")
m = E("m")
e = F("e")
l = E("l")
f = A("f")

b.z = e
b.u = j
b.r = i
d.o = l
j.u = l
j.t = l
i.z = j
i.p = j
m.q = j
e.o = f
l.q = j
f.z = e
f.u = j
f.r = i
assert f.r.z.u.q.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.u: C = None
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

b = A("b")
d = B("d")
j = C("j")
i = D("i")
m = E("m")
e = F("e")
l = E("l")
f = A("f")

b.z = e
b.u = j
b.r = i
d.o = l
j.u = l
j.t = l
i.z = j
i.p = j
m.q = j
e.o = f
l.q = j
f.z = e
f.u = j
f.r = i
assert f.r.z.u.q.u.q.u.txt == "l"