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

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

k = A("k")
a = B("a")
j = B("j")
i = A("i")
c = B("c")
l = A("l")

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

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

k = A("k")
a = B("a")
j = B("j")
i = A("i")
c = B("c")
l = A("l")

k.r = l
a.v = j
j.v = c
i.r = k
c.v = a
l.r = i
assert k.r.r.r.txt == "k"