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

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

f = A("f")
e = B("e")
m = A("m")
k = B("k")
b = B("b")
g = B("g")
l = B("l")

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

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

f = A("f")
e = B("e")
m = A("m")
k = B("k")
b = B("b")
g = B("g")
l = B("l")

f.o = l
f.x = b
e.t = k
e.v = l
m.o = b
m.x = l
k.t = e
k.v = b
b.t = k
b.v = k
g.t = b
g.v = b
l.t = g
l.v = e
assert l.v.v.t.v.v.txt == "k"