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

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

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

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

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

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

e.s = k
e.v = i
k.s = e
i.s = e
assert e.v.s.s.txt == "k"