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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: B = None
        self.q: A = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: B = None
        self.q: D = None
        self.y: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: B = None
        self.q: A = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: B = None
        self.q: D = None
        self.y: A = None
        self.p: B = None
        self.txt = txt

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

d.p = i
d.u = c
b.u = i
b.v = i
b.p = f
b.t = k
b.r = k
f.p = a
f.o = i
f.r = k
k.v = c
k.w = b
k.q = a
k.x = i
i.z = d
i.x = b
i.p = b
i.q = k
i.y = a
c.p = d
c.o = i
c.r = k
l.p = i
l.u = c
a.p = i
a.u = c
n.p = a
n.o = i
n.r = k
assert k.q.u.o.x.p.p.u.o.txt == "i"