import ru.ifmo.validate.*;
import java.util.*;

public class Validate implements Validator {
	static final int MAX_N = 1000;
	static final int LEN = 9;
	static final String set = ValidatingScanner.ENGLISH_UPPER + ValidatingScanner.DIGITS;

	@Override
	public void validate(ValidatingScanner in) throws Exception {
	        in.next(set + "*", LEN);
		in.eoln();
		int n = in.nextInt(1, MAX_N);
		HashSet<String> hs = new HashSet<>();
		for (int i = 0; i < n; i++) {
			in.eoln();
			String word = in.next(set, LEN);
			if (hs.contains(word)) {
				throw new AssertionError("All strings should be different.");
			}
			hs.add(word);
		}
	}

}
