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

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

m = A("m")
n = B("n")
i = A("i")
k = B("k")
c = A("c")
a = A("a")
b = A("b")

m.z = b
m.t = n
n.u = i
n.y = k
i.z = a
i.t = k
k.u = b
k.y = n
c.z = i
c.t = k
a.z = c
a.t = k
b.z = i
b.t = n
assert a.z.t.u.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: B = None
        self.txt = txt

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

m = A("m")
n = B("n")
i = A("i")
k = B("k")
c = A("c")
a = A("a")
b = A("b")

m.z = b
m.t = n
n.u = i
n.y = k
i.z = a
i.t = k
k.u = b
k.y = n
c.z = i
c.t = k
a.z = c
a.t = k
b.z = i
b.t = n
assert a.z.t.u.z.z.txt == "a"