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

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

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

c = A("c")
k = B("k")
m = C("m")
f = A("f")

c.v = m
c.u = m
k.v = c
k.q = m
m.o = c
f.v = m
f.u = m
assert m.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

c = A("c")
k = B("k")
m = C("m")
f = A("f")

c.v = m
c.u = m
k.v = c
k.q = m
m.o = c
f.v = m
f.u = m
assert m.o.v.o.txt == "c"