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

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

k = A("k")
l = B("l")
i = B("i")
n = A("n")
h = B("h")
c = A("c")

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

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

k = A("k")
l = B("l")
i = B("i")
n = A("n")
h = B("h")
c = A("c")

k.v = c
l.v = h
i.v = h
n.v = k
h.v = i
c.v = k
assert c.v.v.v.v.v.v.txt == "c"