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

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

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

a = A("a")
d = B("d")
l = C("l")
n = A("n")

a.x = d
a.t = n
d.u = n
l.p = n
l.o = d
l.x = a
n.x = d
n.t = a
assert l.x.x.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: A = None
        self.txt = txt

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

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

a = A("a")
d = B("d")
l = C("l")
n = A("n")

a.x = d
a.t = n
d.u = n
l.p = n
l.o = d
l.x = a
n.x = d
n.t = a
assert l.x.x.u.t.txt == "a"