用multiset进行存储,可以包涵重复数据
# include<iostream>
# include<set>
using namespace std;
int main(void)
{
int n;
while ((cin >> n) && n != 0)
{
multiset<int>a;
multiset<int>b;
while (n--)
{
int x, y;
cin >> x >> y;
a.insert(x);
b.insert(y);
}
if (a == b)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}