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

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

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

e.r = f
c.q = f
i.q = f
l.q = f
f.r = e
assert i.q.r.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.q: A = None
        self.txt = txt

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

e.r = f
c.q = f
i.q = f
l.q = f
f.r = e
assert i.q.r.r.r.r.txt == "f"