#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
string str;
getline(cin, str);
int f=0;
string temp="";
map<string,int>mpp;
for(int i=0;i<str.size();i++){
if(str[i]!=' ')
temp+=str[i];
else{
mpp[temp]++;
temp="";
}
}
mpp[temp]++;
for(auto it:mpp){
if(it.second>1){
f=1;
cout<<it.first<<" ";
}
}
if(f==0)
cout<<"NA"<<endl;
return 0;
}