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

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

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

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

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

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

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