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

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

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

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

h.y = m
h.x = m
h.v = c
e.r = c
b.z = a
b.o = n
m.y = h
m.x = h
m.v = n
a.z = b
a.o = e
l.r = k
k.r = c
n.r = c
c.r = n
i.r = k
assert b.z.o.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: B = None
        self.x: A = None
        self.txt = txt

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

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

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

h.y = m
h.x = m
h.v = c
e.r = c
b.z = a
b.o = n
m.y = h
m.x = h
m.v = n
a.z = b
a.o = e
l.r = k
k.r = c
n.r = c
c.r = n
i.r = k
assert b.z.o.r.r.r.r.txt == "n"