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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: A = None
        self.w: A = None
        self.x: E = None
        self.z: D = None
        self.txt = txt

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

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

a.q = b
a.p = n
k.s = m
k.y = h
k.o = n
k.x = l
l.y = k
l.o = e
n.r = l
n.y = a
n.w = m
n.x = h
n.z = e
h.p = a
h.u = k
b.s = a
b.y = h
b.o = n
b.x = l
e.r = l
e.y = a
e.w = a
e.x = h
e.z = n
m.q = k
m.p = e
assert h.p.q.o.w.q.y.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: A = None
        self.w: A = None
        self.x: E = None
        self.z: D = None
        self.txt = txt

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

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

a.q = b
a.p = n
k.s = m
k.y = h
k.o = n
k.x = l
l.y = k
l.o = e
n.r = l
n.y = a
n.w = m
n.x = h
n.z = e
h.p = a
h.u = k
b.s = a
b.y = h
b.o = n
b.x = l
e.r = l
e.y = a
e.w = a
e.x = h
e.z = n
m.q = k
m.p = e
assert h.p.q.o.w.q.y.p.p.txt == "n"