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

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

h = A("h")
m = B("m")
f = A("f")
b = A("b")
a = A("a")
n = B("n")
k = A("k")
i = B("i")

h.v = b
h.o = i
m.t = f
f.v = b
f.o = m
b.v = h
b.o = n
a.v = k
a.o = m
n.t = h
k.v = a
k.o = n
i.t = f
assert f.o.t.v.o.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: B = None
        self.txt = txt

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

h = A("h")
m = B("m")
f = A("f")
b = A("b")
a = A("a")
n = B("n")
k = A("k")
i = B("i")

h.v = b
h.o = i
m.t = f
f.v = b
f.o = m
b.v = h
b.o = n
a.v = k
a.o = m
n.t = h
k.v = a
k.o = n
i.t = f
assert f.o.t.v.o.t.v.txt == "b"