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

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

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

h = A("h")
m = B("m")
j = C("j")
c = A("c")
f = C("f")
a = B("a")
e = B("e")
n = A("n")
d = B("d")

h.z = n
h.v = m
m.z = c
m.y = d
m.v = e
j.p = f
j.o = f
j.y = h
c.z = h
c.v = d
f.p = j
f.o = j
f.y = c
a.z = h
a.y = e
a.v = d
e.z = c
e.y = a
e.v = m
n.z = h
n.v = e
d.z = c
d.y = e
d.v = m
assert f.o.y.v.z.v.y.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: B = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
j = C("j")
c = A("c")
f = C("f")
a = B("a")
e = B("e")
n = A("n")
d = B("d")

h.z = n
h.v = m
m.z = c
m.y = d
m.v = e
j.p = f
j.o = f
j.y = h
c.z = h
c.v = d
f.p = j
f.o = j
f.y = c
a.z = h
a.y = e
a.v = d
e.z = c
e.y = a
e.v = m
n.z = h
n.v = e
d.z = c
d.y = e
d.v = m
assert f.o.y.v.z.v.y.v.v.txt == "e"