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

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

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

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

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

n = A("n")
d = B("d")
k = C("k")
h = D("h")
l = E("l")
m = A("m")
j = B("j")
i = B("i")
f = A("f")

n.p = f
n.o = k
n.x = d
d.s = k
d.p = j
k.z = l
h.q = i
l.o = h
l.u = f
l.z = k
m.p = f
m.o = k
m.x = j
j.s = k
j.p = d
i.s = k
i.p = d
f.p = n
f.o = k
f.x = d
assert k.z.u.o.z.z.z.u.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

n = A("n")
d = B("d")
k = C("k")
h = D("h")
l = E("l")
m = A("m")
j = B("j")
i = B("i")
f = A("f")

n.p = f
n.o = k
n.x = d
d.s = k
d.p = j
k.z = l
h.q = i
l.o = h
l.u = f
l.z = k
m.p = f
m.o = k
m.x = j
j.s = k
j.p = d
i.s = k
i.p = d
f.p = n
f.o = k
f.x = d
assert k.z.u.o.z.z.z.u.o.z.txt == "l"