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: B = None
        self.u: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
d = C("d")
b = A("b")
j = B("j")
e = B("e")

i.t = b
i.u = d
f.s = e
f.u = i
d.y = f
b.t = i
b.u = d
j.s = e
j.u = i
e.s = f
e.u = b
assert e.s.s.u.t.t.t.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: B = None
        self.u: A = None
        self.txt = txt

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

i = A("i")
f = B("f")
d = C("d")
b = A("b")
j = B("j")
e = B("e")

i.t = b
i.u = d
f.s = e
f.u = i
d.y = f
b.t = i
b.u = d
j.s = e
j.u = i
e.s = f
e.u = b
assert e.s.s.u.t.t.t.txt == "i"