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

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

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

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

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

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

e.x = a
e.t = k
k.v = e
a.x = e
a.t = f
j.x = e
j.t = k
m.v = e
l.v = j
f.v = e
i.v = j
assert f.v.t.v.x.x.txt == "e"