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

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

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

b = A("b")
l = B("l")
c = C("c")
k = A("k")

b.t = k
l.y = c
c.z = l
k.t = b
assert b.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

b = A("b")
l = B("l")
c = C("c")
k = A("k")

b.t = k
l.y = c
c.z = l
k.t = b
assert b.t.t.t.txt == "k"