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

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

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

m = A("m")
b = B("b")
j = C("j")
e = A("e")
l = B("l")

m.v = e
b.o = l
j.p = l
j.x = m
j.u = b
e.v = m
l.o = b
assert e.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
j = C("j")
e = A("e")
l = B("l")

m.v = e
b.o = l
j.p = l
j.x = m
j.u = b
e.v = m
l.o = b
assert e.v.v.v.txt == "m"