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

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

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

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

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

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

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

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

a.u = h
a.t = f
a.z = m
n.w = h
n.p = f
e.v = m
e.o = b
k.w = m
k.p = a
i.w = m
i.p = f
b.w = h
b.p = f
m.v = h
m.o = b
f.u = h
f.t = a
f.z = m
h.v = m
h.o = k
assert m.v.v.v.v.o.w.o.txt == "k"