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

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

l = A("l")
d = B("d")
k = A("k")
i = A("i")
a = B("a")
c = B("c")
b = A("b")

l.t = d
l.z = k
d.v = i
d.t = k
k.t = c
k.z = l
i.t = a
i.z = b
a.v = k
a.t = l
c.v = i
c.t = b
b.t = c
b.z = k
assert i.t.v.z.z.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.txt = txt

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

l = A("l")
d = B("d")
k = A("k")
i = A("i")
a = B("a")
c = B("c")
b = A("b")

l.t = d
l.z = k
d.v = i
d.t = k
k.t = c
k.z = l
i.t = a
i.z = b
a.v = k
a.t = l
c.v = i
c.t = b
b.t = c
b.z = k
assert i.t.v.z.z.z.t.txt == "d"