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.w: B = None
        self.txt = txt

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

c.v = n
c.o = h
n.w = h
h.w = n
assert h.w.w.w.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.w: B = None
        self.txt = txt

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

c.v = n
c.o = h
n.w = h
h.w = n
assert h.w.w.w.txt == "n"