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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

e.o = a
c.s = n
j.q = n
j.z = n
j.v = c
j.u = a
j.p = a
n.z = j
n.r = h
b.p = a
b.y = j
m.p = e
m.y = j
a.o = e
h.q = n
h.z = n
h.v = c
h.u = e
h.p = e
assert a.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

e.o = a
c.s = n
j.q = n
j.z = n
j.v = c
j.u = a
j.p = a
n.z = j
n.r = h
b.p = a
b.y = j
m.p = e
m.y = j
a.o = e
h.q = n
h.z = n
h.v = c
h.u = e
h.p = e
assert a.o.o.o.o.o.o.o.txt == "e"