For this Question: Given N strings and Q queries, for each query you will be given a string, your task is to print all the anagrams of the string from the given N strings. If no anagrams exist then print -1.

Note:- Given string may contain duplicated strings you should print it as many times as it occurs.First line of input contains a single integer N, second line of input contains N space separated strings. Third line of input contains a single integer Q, next Q line contains a single string each.

Constraints:-
1 < = N < = 1000
1 < = |String| < = 10
1 < = Q < = 100000

Note:-String will only contain lower case english lettersFor each query in a new line print the anagrams in lexicographical order separated by spaces.Sample Input:-
6
cat tea pet tac act eat
4
cat
tca
eee
tea

Sample Output:-
act cat tac
act cat tac
-1
eat tea, I have written this Solution Code: #include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795
#define max1 200001
#define MOD 1000000007

#define read(type) readInt<type>()
#define int long long
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'

void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
unordered_map<string,vector<string>> m;
signed main(){

int n;
cin>>n;
string s,p;
while(n--){
    cin>>s;
    p=s;
    sort(s.begin(),s.end());
    m[s].EB(p);
}
for(auto it =m.begin();it!=m.end();it++){

    sort(it->second.begin(),it->second.end());
}
int q;
cin>>q;
while(q--){
    cin>>s;
    sort(s.begin(),s.end());
    if(m.find(s)==m.end()){out(-1);continue;}
    else{
        vector<string> v = m[s];
        for(int i=0;i<v.size();i++){
            out1(v[i]);
        }
        END;
    }
}
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?