Company: Flipkart_24dec
Difficulty: medium
Racing Tournament Racing Tournament Problem Description A racing tournament is underway with competitors from all kinds of backgrounds. Races can be held on three different terrains: 1. Hilly terrain 2. City Race 3. Off-Roading On each terrain, every racer has a personal ranking reflecting their skill there, with rank 1 being the best. Whenever two racers face off on a given terrain, the one with the lower rank on that terrain always wins. The event follows a round-robin format: every pair of contestants races exactly once. Because each pair only meets a single time, picking the right terrain for their race matters a great deal. The organizers pick the terrain for each race by applying these rules, based on the three rank lists: Each race should be raced on the terrain in which the winner would be the strongest (i.e., the winner must have the lowest rank in the corresponding rank list). In case of a tie in the winner's rank (e.g., racer 1 wins on Hilly terrain with rank 1, and racer 2