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

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

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

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

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

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

n.o = j
n.q = a
f.t = n
e.t = a
i.o = f
i.s = f
i.z = k
i.u = m
i.y = b
b.p = k
b.r = i
b.q = a
k.t = a
j.o = n
j.q = a
m.o = a
m.s = a
m.z = k
m.u = i
m.y = b
a.t = j
assert b.r.y.p.t.t.q.t.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

n.o = j
n.q = a
f.t = n
e.t = a
i.o = f
i.s = f
i.z = k
i.u = m
i.y = b
b.p = k
b.r = i
b.q = a
k.t = a
j.o = n
j.q = a
m.o = a
m.s = a
m.z = k
m.u = i
m.y = b
a.t = j
assert b.r.y.p.t.t.q.t.o.o.txt == "j"