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

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

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

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

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

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

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