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

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

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

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

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

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

n.p = f
n.o = l
n.v = c
n.t = i
l.o = h
c.x = h
k.o = h
k.p = l
k.z = e
d.z = l
i.z = h
f.x = h
h.o = l
a.p = f
a.v = f
a.o = h
a.t = i
e.p = c
e.o = h
e.v = f
e.t = i
assert k.p.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: B = None
        self.v: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

n.p = f
n.o = l
n.v = c
n.t = i
l.o = h
c.x = h
k.o = h
k.p = l
k.z = e
d.z = l
i.z = h
f.x = h
h.o = l
a.p = f
a.v = f
a.o = h
a.t = i
e.p = c
e.o = h
e.v = f
e.t = i
assert k.p.o.o.o.o.o.o.txt == "l"