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

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

b = A("b")
n = B("n")
a = A("a")
c = B("c")

b.y = c
n.o = c
n.t = a
a.y = c
c.o = n
c.t = a
assert c.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

b = A("b")
n = B("n")
a = A("a")
c = B("c")

b.y = c
n.o = c
n.t = a
a.y = c
c.o = n
c.t = a
assert c.o.o.o.o.txt == "c"