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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

a.p = f
b.o = l
b.w = i
k.q = a
k.p = n
c.o = a
c.s = a
c.q = b
i.u = k
i.t = k
i.s = c
i.x = l
e.o = i
e.w = i
l.u = f
l.t = f
l.s = n
l.x = i
f.q = a
f.p = c
n.o = a
n.s = a
n.q = e
assert b.o.s.o.p.q.p.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

a.p = f
b.o = l
b.w = i
k.q = a
k.p = n
c.o = a
c.s = a
c.q = b
i.u = k
i.t = k
i.s = c
i.x = l
e.o = i
e.w = i
l.u = f
l.t = f
l.s = n
l.x = i
f.q = a
f.p = c
n.o = a
n.s = a
n.q = e
assert b.o.s.o.p.q.p.q.p.txt == "f"