One of the classic ways to identify a crime suspect is through the fingerprints they leave behind. To use fingerprints for identification, the police keep a large database of known fingerprints and compare a print found at a crime scene against it to find the closest match. Your task is to write a program that performs that search.
Each fingerprint is a $5 \times 5$ black-and-white bitmap. A black pixel is written as x and a white pixel as .. A fingerprint is therefore given as 5 lines of 5 characters each, where every character is either x or ..
The distance between two fingerprints is the number of pixel positions at which they differ. The best match for a fingerprint is the database fingerprint with the smallest distance to it.
The first line contains two integers $n$ and $K$, where $n\ (n \le 100)$ is the number of fingerprints in the database and $K\ (K \le 20)$ is the number of crime-scene fingerprints to identify.
Next come the $n$ database fingerprints, each given as 5 lines of 5 characters. After them come the $K$ crime-scene fingerprints, also each given as 5 lines of 5 characters.
For each crime-scene fingerprint, first print Data Set x: on its own line, where $x$ is the fingerprint's number, starting from 1. On the next line, print the index (between 1 and $n$) of the best matching database fingerprint. If several database fingerprints are tied for the best match, print all of their indices on one line in increasing order, separated by single spaces.
Print a blank line between the results of consecutive data sets.