Company: Providence
Difficulty: medium
Bachata Dance Pairs Problem Description Bachata is a style of social dance from the Dominican Republic which is now danced all over the world. Dancers are paired as couples to perform the dance, and to look visually appealing, the pair is usually made of people with similar height. Alice runs a dance academy, and for her new Bachata batch, a lot of dancers have registered. She now has to pair them into couples, and decides that a couple can differ in height by no more than 2 inches. Any person who can't fit into such a couple has to leave. Alice wants to give higher priority to the participants with smaller height to form a couple. If more than one choice is available to form a couple, then the priority is given to participants arriving earlier i.e. 'first come first serve' principle is applied. Write a program to help Alice form the pairs, given the number of participants n, and the name and height of each participant. Assume a unique solution exists. Read the input from STDIN and pri