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

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

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

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

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

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

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

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

a.y = k
a.v = n
a.z = m
e.z = j
e.o = i
e.y = h
j.x = h
j.t = k
i.x = a
i.t = m
m.x = h
m.t = j
n.y = k
n.v = a
n.z = m
h.y = j
h.v = n
h.z = i
c.z = m
c.o = j
c.y = a
k.x = h
k.t = m
assert m.x.z.x.z.x.txt == "h"