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.v: A = None
        self.txt = txt

l = A("l")
h = B("h")
g = A("g")
c = B("c")
b = A("b")
k = B("k")
d = B("d")
i = B("i")
e = A("e")

l.z = b
l.t = h
h.v = l
g.z = b
g.t = i
c.v = e
b.z = l
b.t = i
k.v = e
d.v = l
i.v = l
e.z = g
e.t = k
assert l.t.v.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.v: A = None
        self.txt = txt

l = A("l")
h = B("h")
g = A("g")
c = B("c")
b = A("b")
k = B("k")
d = B("d")
i = B("i")
e = A("e")

l.z = b
l.t = h
h.v = l
g.z = b
g.t = i
c.v = e
b.z = l
b.t = i
k.v = e
d.v = l
i.v = l
e.z = g
e.t = k
assert l.t.v.z.z.txt == "l"