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

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

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

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

a = A("a")
n = B("n")
c = C("c")
k = D("k")
g = D("g")
m = C("m")
i = C("i")
e = C("e")

a.p = n
a.u = n
n.w = m
n.x = a
n.o = a
c.r = g
c.z = i
c.y = n
k.o = a
k.z = n
k.q = n
k.t = n
g.o = a
g.z = n
g.q = n
g.t = n
m.r = k
m.z = c
m.y = n
i.r = g
i.z = m
i.y = n
e.r = k
e.z = i
e.y = n
assert k.t.o.p.w.y.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: B = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
c = C("c")
k = D("k")
g = D("g")
m = C("m")
i = C("i")
e = C("e")

a.p = n
a.u = n
n.w = m
n.x = a
n.o = a
c.r = g
c.z = i
c.y = n
k.o = a
k.z = n
k.q = n
k.t = n
g.o = a
g.z = n
g.q = n
g.t = n
m.r = k
m.z = c
m.y = n
i.r = g
i.z = m
i.y = n
e.r = k
e.z = i
e.y = n
assert k.t.o.p.w.y.o.u.txt == "n"