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

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

e = A("e")
h = B("h")
n = A("n")
i = B("i")
k = B("k")

e.o = i
h.v = k
n.o = h
i.v = k
k.v = i
assert i.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

e = A("e")
h = B("h")
n = A("n")
i = B("i")
k = B("k")

e.o = i
h.v = k
n.o = h
i.v = k
k.v = i
assert i.v.v.v.v.v.txt == "k"