#include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
int arr1[n] , arr2[n];
for ( int i = 0 ; i < n ; i ++ )
{
cin >> arr1[i];
for ( int j = 0 ; j < i ; j ++ )
{
if ( arr1[i] > arr1[j] )
{
swap (arr1[i] , arr1[j] );
}
}
}
for ( int i = 0 ; i < n ; i ++ )
{
cin >> arr2[i];
for ( int j = 0 ; j < i ; j ++ )
{
if ( arr2[i] > arr2[j] )
{
swap (arr2[i] , arr2[j] );
}
}
}
int counter = 0;
for ( int i = 0 ; i < n ; i ++ )
{
if ( arr1[i] == arr2[i] )
{
counter ++;
}
if ( i == n - 1 )
{
if ( counter == n )
{
cout <<"Yes";
}
else
{
cout <<"No";
}
}
}
return 0;
}