class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = 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.q: B = None
        self.z: C = None
        self.txt = txt

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

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

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

j.u = k
j.w = e
a.q = d
d.q = k
d.z = h
b.y = e
b.p = c
n.o = j
n.p = d
c.o = j
c.p = d
l.y = e
l.p = n
h.q = a
h.z = e
k.q = h
e.q = k
e.z = d
assert b.y.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: C = 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.q: B = None
        self.z: C = None
        self.txt = txt

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

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

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

j.u = k
j.w = e
a.q = d
d.q = k
d.z = h
b.y = e
b.p = c
n.o = j
n.p = d
c.o = j
c.p = d
l.y = e
l.p = n
h.q = a
h.z = e
k.q = h
e.q = k
e.z = d
assert b.y.q.q.q.q.q.txt == "k"