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

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

c = A("c")
h = B("h")
n = B("n")

c.v = n
c.z = n
h.o = c
h.u = c
n.o = c
n.u = c
assert c.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = None
        self.txt = txt

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

c = A("c")
h = B("h")
n = B("n")

c.v = n
c.z = n
h.o = c
h.u = c
n.o = c
n.u = c
assert c.z.u.z.txt == "n"