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

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

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

a = A("a")
k = B("k")
f = C("f")
l = B("l")
g = B("g")
i = C("i")
j = C("j")
d = A("d")

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

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

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

a = A("a")
k = B("k")
f = C("f")
l = B("l")
g = B("g")
i = C("i")
j = C("j")
d = A("d")

a.u = i
k.y = a
f.s = d
l.y = d
g.y = d
i.s = d
j.s = d
d.u = i
assert i.s.u.s.u.s.u.txt == "i"