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

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

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

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

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

n = A("n")
j = B("j")
m = C("m")
k = D("k")
i = E("i")
b = C("b")
e = D("e")
c = B("c")
h = B("h")
a = A("a")

n.x = b
n.p = i
n.s = j
j.q = m
m.o = e
k.v = i
i.y = k
i.x = h
b.o = e
e.v = i
c.q = b
h.q = b
a.x = b
a.p = i
a.s = j
assert n.p.x.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: E = None
        self.s: B = None
        self.txt = txt

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

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

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

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

n = A("n")
j = B("j")
m = C("m")
k = D("k")
i = E("i")
b = C("b")
e = D("e")
c = B("c")
h = B("h")
a = A("a")

n.x = b
n.p = i
n.s = j
j.q = m
m.o = e
k.v = i
i.y = k
i.x = h
b.o = e
e.v = i
c.q = b
h.q = b
a.x = b
a.p = i
a.s = j
assert n.p.x.q.o.txt == "e"