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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: C = None
        self.o: C = None
        self.q: B = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

f = A("f")
h = B("h")
l = C("l")
k = D("k")
j = E("j")
d = F("d")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: C = None
        self.o: C = None
        self.q: B = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

f = A("f")
h = B("h")
l = C("l")
k = D("k")
j = E("j")
d = F("d")

f.x = j
f.u = d
h.z = j
l.x = d
k.u = h
k.p = d
k.z = f
k.r = f
j.t = d
j.z = h
d.v = j
d.r = l
d.o = l
d.q = h
d.w = f
d.x = f
assert j.z.z.z.txt == "h"