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

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

i = A("i")
g = B("g")
e = B("e")
f = A("f")
j = B("j")
a = A("a")
m = A("m")

i.v = m
i.t = f
g.v = e
g.z = j
e.v = g
e.z = j
f.v = i
f.t = a
j.v = e
j.z = g
a.v = m
a.t = f
m.v = a
m.t = f
assert f.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: A = None
        self.txt = txt

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

i = A("i")
g = B("g")
e = B("e")
f = A("f")
j = B("j")
a = A("a")
m = A("m")

i.v = m
i.t = f
g.v = e
g.z = j
e.v = g
e.z = j
f.v = i
f.t = a
j.v = e
j.z = g
a.v = m
a.t = f
m.v = a
m.t = f
assert f.v.t.v.txt == "i"