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

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

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

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

d = A("d")
j = B("j")
m = C("m")
n = D("n")
l = B("l")
g = D("g")
f = D("f")
b = B("b")
k = C("k")

d.s = m
j.o = m
j.w = m
m.o = f
m.y = f
n.s = m
n.x = d
n.v = d
l.o = k
l.w = m
g.s = m
g.x = d
g.v = d
f.s = m
f.x = d
f.v = d
b.o = k
b.w = k
k.o = n
k.y = g
assert n.x.s.y.v.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

d = A("d")
j = B("j")
m = C("m")
n = D("n")
l = B("l")
g = D("g")
f = D("f")
b = B("b")
k = C("k")

d.s = m
j.o = m
j.w = m
m.o = f
m.y = f
n.s = m
n.x = d
n.v = d
l.o = k
l.w = m
g.s = m
g.x = d
g.v = d
f.s = m
f.x = d
f.v = d
b.o = k
b.w = k
k.o = n
k.y = g
assert n.x.s.y.v.s.o.s.txt == "m"