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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: E = None
        self.u: C = None
        self.v: C = None
        self.p: A = None
        self.txt = txt

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

m = A("m")
j = B("j")
f = C("f")
k = D("k")
d = E("d")
l = B("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: E = None
        self.u: C = None
        self.v: C = None
        self.p: A = None
        self.txt = txt

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

m = A("m")
j = B("j")
f = C("f")
k = D("k")
d = E("d")
l = B("l")

m.p = d
j.p = d
j.y = m
j.o = f
f.t = k
f.y = k
f.r = k
f.p = d
f.o = d
k.o = m
k.p = m
k.r = d
k.u = f
k.v = f
d.s = m
l.p = d
l.y = m
l.o = f
assert l.p.s.p.s.p.txt == "d"