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

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

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

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

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

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

n.u = h
n.o = b
k.t = a
k.v = a
i.u = n
i.o = b
l.u = n
l.o = b
h.u = l
h.o = a
a.t = k
a.v = k
b.t = k
b.v = k
assert b.t.v.t.t.txt == "a"