Pergunta de entrevista da empresa Uber

They gave me tables i/p and o/p and asked to write SQL query