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

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

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

f = A("f")
d = B("d")
m = C("m")
l = C("l")
a = A("a")
b = B("b")
k = C("k")
g = A("g")

f.y = l
f.s = g
f.z = k
d.w = g
m.u = l
l.u = k
a.y = m
a.s = g
a.z = k
b.w = f
k.u = l
g.y = k
g.s = a
g.z = m
assert k.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: A = None
        self.z: C = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
m = C("m")
l = C("l")
a = A("a")
b = B("b")
k = C("k")
g = A("g")

f.y = l
f.s = g
f.z = k
d.w = g
m.u = l
l.u = k
a.y = m
a.s = g
a.z = k
b.w = f
k.u = l
g.y = k
g.s = a
g.z = m
assert k.u.u.u.u.u.u.u.txt == "l"