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

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

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

i = A("i")
l = B("l")
g = C("g")
b = C("b")

i.t = l
l.x = g
g.y = i
b.y = i
assert b.y.t.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

i = A("i")
l = B("l")
g = C("g")
b = C("b")

i.t = l
l.x = g
g.y = i
b.y = i
assert b.y.t.x.y.txt == "i"