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

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

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

e = A("e")
a = B("a")
h = C("h")
b = C("b")
d = A("d")
l = A("l")
m = C("m")
k = C("k")

e.v = b
e.u = a
a.x = m
h.z = b
h.x = l
h.p = k
b.z = h
b.x = l
b.p = k
d.v = k
d.u = a
l.v = h
l.u = a
m.z = h
m.x = l
m.p = b
k.z = m
k.x = e
k.p = b
assert h.p.p.x.u.x.p.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

e = A("e")
a = B("a")
h = C("h")
b = C("b")
d = A("d")
l = A("l")
m = C("m")
k = C("k")

e.v = b
e.u = a
a.x = m
h.z = b
h.x = l
h.p = k
b.z = h
b.x = l
b.p = k
d.v = k
d.u = a
l.v = h
l.u = a
m.z = h
m.x = l
m.p = b
k.z = m
k.x = e
k.p = b
assert h.p.p.x.u.x.p.p.z.txt == "m"