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

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: F = None
        self.txt = txt

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

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

b = A("b")
f = B("f")
k = C("k")
d = D("d")
c = E("c")
a = F("a")
l = F("l")

b.z = a
f.o = c
f.w = c
k.u = f
d.p = a
d.v = a
c.z = k
c.y = d
c.t = f
a.r = b
a.u = c
l.r = b
l.u = c
assert a.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: F = None
        self.txt = txt

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

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

b = A("b")
f = B("f")
k = C("k")
d = D("d")
c = E("c")
a = F("a")
l = F("l")

b.z = a
f.o = c
f.w = c
k.u = f
d.p = a
d.v = a
c.z = k
c.y = d
c.t = f
a.r = b
a.u = c
l.r = b
l.u = c
assert a.u.z.u.txt == "f"