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

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

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

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

m = A("m")
b = B("b")
a = C("a")
e = D("e")
n = B("n")
c = A("c")

m.s = c
m.o = c
m.y = c
m.v = c
b.r = m
b.z = c
a.x = e
a.w = n
a.q = m
e.u = b
n.r = m
n.z = c
c.s = m
c.o = m
c.y = m
c.v = m
assert b.r.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: A = None
        self.y: A = None
        self.v: A = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
a = C("a")
e = D("e")
n = B("n")
c = A("c")

m.s = c
m.o = c
m.y = c
m.v = c
b.r = m
b.z = c
a.x = e
a.w = n
a.q = m
e.u = b
n.r = m
n.z = c
c.s = m
c.o = m
c.y = m
c.v = m
assert b.r.s.s.txt == "m"