http://acm.hdu.edu.cn/showproblem.php?pid=5058
#include <set>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
set <int> s1,s2;
set <int>::iterator ps1,ps2;
int main(){
// freopen("in.txt", "r", stdin);
int n;
while(scanf("%d",&n) != EOF){
s1.clear(), s2.clear();
int a,b;
for(int i=0; i<n; i++){
scanf("%d",&a);
s1.insert(a);
}
for(int i=0; i<n; i++){
scanf("%d",&b);
s2.insert(b);
}
bool flag = true;
for(ps1 = s1.begin(),ps2 = s2.begin(); ps1 != s1.end() && ps2 != s2.end(); ps1++, ps2++){
if(*ps1 != *ps2){
flag = false;
break;
}
}
if(flag && ps1 == s1.end()&& ps2 == s2.end()) puts("YES");
else puts("NO");
}
return 0;
}