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

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

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

l.t = c
l.v = a
n.z = a
n.x = a
a.t = c
a.v = l
c.z = a
c.x = l
assert c.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.txt = txt

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

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

l.t = c
l.v = a
n.z = a
n.x = a
a.t = c
a.v = l
c.z = a
c.x = l
assert c.z.t.z.txt == "a"