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

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

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

i = A("i")
h = B("h")
j = C("j")
e = C("e")
d = C("d")

i.z = h
h.x = i
j.y = e
j.u = h
j.t = d
e.y = j
e.t = j
e.u = h
d.y = j
d.t = j
d.u = h
assert d.t.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
j = C("j")
e = C("e")
d = C("d")

i.z = h
h.x = i
j.y = e
j.u = h
j.t = d
e.y = j
e.t = j
e.u = h
d.y = j
d.t = j
d.u = h
assert d.t.u.x.txt == "i"