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

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

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

m = A("m")
k = B("k")
j = C("j")
l = B("l")
a = C("a")

m.s = k
m.o = l
k.v = l
k.y = l
k.u = a
j.z = k
l.v = k
l.y = k
l.u = j
a.z = k
assert m.s.y.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: B = None
        self.txt = txt

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

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

m = A("m")
k = B("k")
j = C("j")
l = B("l")
a = C("a")

m.s = k
m.o = l
k.v = l
k.y = l
k.u = a
j.z = k
l.v = k
l.y = k
l.u = j
a.z = k
assert m.s.y.y.u.txt == "a"