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

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

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

f = A("f")
l = B("l")
i = C("i")
b = A("b")
m = B("m")
n = C("n")
d = C("d")

f.t = b
f.u = d
l.s = i
l.w = i
l.t = f
i.u = d
b.t = f
b.u = i
m.s = n
m.w = d
m.t = f
n.u = d
d.u = n
assert d.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: C = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
i = C("i")
b = A("b")
m = B("m")
n = C("n")
d = C("d")

f.t = b
f.u = d
l.s = i
l.w = i
l.t = f
i.u = d
b.t = f
b.u = i
m.s = n
m.w = d
m.t = f
n.u = d
d.u = n
assert d.u.u.u.u.u.u.u.txt == "n"