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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

n = A("n")
b = B("b")
k = C("k")
m = D("m")
j = E("j")
l = D("l")

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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.q: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

n = A("n")
b = B("b")
k = C("k")
m = D("m")
j = E("j")
l = D("l")

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