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

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

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

b = A("b")
l = B("l")
f = C("f")

b.t = l
b.y = f
l.u = b
l.z = b
f.p = l
f.y = b
assert f.p.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: C = None
        self.txt = txt

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

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

b = A("b")
l = B("l")
f = C("f")

b.t = l
b.y = f
l.u = b
l.z = b
f.p = l
f.y = b
assert f.p.z.t.txt == "l"