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

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

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

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

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

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

f.q = l
f.v = l
c.w = l
l.q = f
l.v = f
i.w = f
assert i.w.q.v.q.txt == "l"