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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: E = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

k.o = b
k.p = i
c.u = b
c.t = a
c.o = a
c.q = e
l.u = m
e.v = l
e.u = h
a.v = n
a.s = n
a.z = h
h.v = l
h.s = n
h.z = a
n.u = m
b.v = n
b.u = a
i.o = b
i.p = k
m.u = n
assert a.s.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: E = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

k.o = b
k.p = i
c.u = b
c.t = a
c.o = a
c.q = e
l.u = m
e.v = l
e.u = h
a.v = n
a.s = n
a.z = h
h.v = l
h.s = n
h.z = a
n.u = m
b.v = n
b.u = a
i.o = b
i.p = k
m.u = n
assert a.s.u.u.u.u.txt == "n"