#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> a(n), b(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
cin >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
int days = b[n - 1] - a[n - 1];
bool ok = days >= 0;
for (int i = 0; i < n; i++)
if (b[i] < a[i] || b[i] - a[i] > days)
ok = false;
if (ok)
cout << "Yes\n";
else
cout << "No\n";
return 0;
}