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

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

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

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

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

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

c.y = n
f.u = a
f.o = a
n.y = c
a.u = f
a.o = f
assert a.o.o.o.txt == "f"