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

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

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

k = A("k")
a = B("a")
e = C("e")
b = B("b")
c = B("c")
g = B("g")
m = A("m")
l = B("l")

k.u = e
k.z = m
a.s = c
e.q = k
e.t = k
e.r = b
b.s = a
c.s = l
g.s = b
m.u = e
m.z = k
l.s = c
assert b.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: A = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
e = C("e")
b = B("b")
c = B("c")
g = B("g")
m = A("m")
l = B("l")

k.u = e
k.z = m
a.s = c
e.q = k
e.t = k
e.r = b
b.s = a
c.s = l
g.s = b
m.u = e
m.z = k
l.s = c
assert b.s.s.s.s.s.s.s.txt == "l"