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

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

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

m = A("m")
a = B("a")
c = C("c")
l = C("l")

m.y = l
a.w = l
c.v = l
c.u = m
l.v = c
l.u = m
assert c.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

m = A("m")
a = B("a")
c = C("c")
l = C("l")

m.y = l
a.w = l
c.v = l
c.u = m
l.v = c
l.u = m
assert c.u.y.u.txt == "m"