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

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

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

j = A("j")
c = B("c")
m = C("m")
g = A("g")
i = A("i")
h = C("h")
l = A("l")

j.t = m
j.s = m
c.z = l
m.u = c
g.t = h
g.s = m
i.t = m
i.s = m
h.u = c
l.t = h
l.s = m
assert c.z.s.u.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: C = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
m = C("m")
g = A("g")
i = A("i")
h = C("h")
l = A("l")

j.t = m
j.s = m
c.z = l
m.u = c
g.t = h
g.s = m
i.t = m
i.s = m
h.u = c
l.t = h
l.s = m
assert c.z.s.u.z.s.txt == "m"