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

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

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

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

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

d = A("d")
c = B("c")
m = C("m")
a = D("a")
k = E("k")
b = E("b")
l = D("l")
f = B("f")
e = E("e")

d.u = e
c.v = f
c.o = m
m.s = e
m.y = a
a.s = m
a.r = l
k.p = l
b.p = l
l.s = m
l.r = a
f.v = c
f.o = m
e.p = l
assert m.s.p.s.y.s.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
m = C("m")
a = D("a")
k = E("k")
b = E("b")
l = D("l")
f = B("f")
e = E("e")

d.u = e
c.v = f
c.o = m
m.s = e
m.y = a
a.s = m
a.r = l
k.p = l
b.p = l
l.s = m
l.r = a
f.v = c
f.o = m
e.p = l
assert m.s.p.s.y.s.y.r.txt == "l"