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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.u: C = None
        self.q: A = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
l = C("l")
f = D("f")
j = A("j")

g.z = f
e.w = f
e.v = f
e.u = l
e.q = g
l.z = f
l.p = e
l.q = e
f.t = j
f.u = j
j.z = f
assert e.u.z.u.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.u: C = None
        self.q: A = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
l = C("l")
f = D("f")
j = A("j")

g.z = f
e.w = f
e.v = f
e.u = l
e.q = g
l.z = f
l.p = e
l.q = e
f.t = j
f.u = j
j.z = f
assert e.u.z.u.z.t.txt == "j"