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

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

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

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

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

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

f.y = n
c.q = l
i.y = l
n.q = l
m.y = l
l.q = c
assert n.q.q.q.q.q.txt == "l"