#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     string s[t];     for (int i = 0; i < t; i++) {       cin >> s[i];     }     map<string, int> m;     for (int j = 0; j < t; j++) {       for (int l = 1; l <= 9; l++) {         for (int i = 0; i < 10 - l; i++) {           string p = s[j].substr(i, l);           if (m.find(p) != m.end()) {             if (m[p] != j) {               m[p] = -1;             }           } else {             m[p] = j;           }         }       }     }     string ans[t];     for (int i = 0; i < t; i++) {       ans[i] =  a ;     }     for (auto it = m.begin(); it != m.end(); it++) {       int x = it->second;       string y = it->first;       if (x == -1) {         continue;       }       if (ans[x] ==  a  || ans[x].size() > y.size()) {         ans[x] = y;       }     }     for (int i = 0; i < t; i++) {       cout << ans[i] << endl;     }   }   