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

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

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

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

i = A("i")
h = B("h")
e = C("e")
k = D("k")
g = C("g")
j = C("j")

i.s = e
i.z = j
h.q = i
h.t = g
e.y = g
e.t = i
k.u = h
k.t = i
g.y = j
g.t = i
j.y = e
j.t = i
assert k.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: C = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
e = C("e")
k = D("k")
g = C("g")
j = C("j")

i.s = e
i.z = j
h.q = i
h.t = g
e.y = g
e.t = i
k.u = h
k.t = i
g.y = j
g.t = i
j.y = e
j.t = i
assert k.t.s.t.txt == "i"