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

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

c = A("c")
l = B("l")
i = B("i")

c.y = l
l.q = c
l.y = c
i.q = c
i.y = c
assert c.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

c = A("c")
l = B("l")
i = B("i")

c.y = l
l.q = c
l.y = c
i.q = c
i.y = c
assert c.y.q.y.txt == "l"