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

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

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

h = A("h")
k = B("k")
e = C("e")
a = C("a")
i = A("i")
l = B("l")
m = C("m")
n = C("n")

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

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

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

h = A("h")
k = B("k")
e = C("e")
a = C("a")
i = A("i")
l = B("l")
m = C("m")
n = C("n")

h.z = i
h.v = m
h.p = a
k.x = h
k.t = e
e.t = n
e.v = h
a.t = e
a.v = h
i.z = h
i.v = m
i.p = m
l.x = i
l.t = e
m.t = e
m.v = h
n.t = e
n.v = i
assert l.t.v.z.p.v.txt == "h"