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

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

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

n = A("n")
l = B("l")
i = C("i")

n.v = l
n.w = i
l.q = n
i.o = n
assert n.w.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: C = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
i = C("i")

n.v = l
n.w = i
l.q = n
i.o = n
assert n.w.o.v.txt == "l"