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

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

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

m = A("m")
i = B("i")
d = C("d")

m.u = d
m.o = d
i.s = d
i.p = d
d.v = i
assert d.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: C = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
d = C("d")

m.u = d
m.o = d
i.s = d
i.p = d
d.v = i
assert d.v.s.v.txt == "i"