#include<bits/stdc++.h>
using namespace std; 
long long int power(long long  int x,long long int y,long long  int p)  
{  
    long long int res = 1;     
  
    x = x % p;
    if (x == 0) return 0;
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}  
long long int gcdExtended(long long int a,long long int b, long long int *x,long long  int *y) 
{ 
	if (a == 0) 
	{ 
		*x = 0, *y = 1; 
		return b; 
	} 

	long long int x1, y1;  
	long long int gcd = gcdExtended(b%a, a, &x1, &y1); 
	*x = y1 - (b/a) * x1; 
	*y = x1; 
    return gcd; 
}  
long long int modInverse( long long int b,long long int m) 
{ 
	long long int x, y; 
	long long int g = gcdExtended(b, m, &x, &y); 
	if (g != 1) 
		return -1; 
	return (x%m + m) % m; 
}  
long long modDivide(long long int a,long long int b,long long int m) 
{ 
	a = power(10,a,m); 
	long long int inv = modInverse(b, m); 
	return (inv*a)%m;
} 
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int mod=1000000007;
    int t=1;
//    cin>>t;
    while(t--){
      int n;
      cin>>n;
      vector<int> arr(n);
      for(int i=0;i<n;i++){
      	cin>>arr[i];
	  }
	  int sum=0;
	  for(int i=0;i<n;i++){
	  	int b;
	  	cin>>b;
	  	arr[i]*=b;
	  	sum+=arr[i];
	  }
	  if(sum==0){
	  	cout<<"Yes\n";
	  }
	  else
	  cout<<"No\n";
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define I inline int
#define V inline void
#define ll long long int
#define isnum(ch) ('0'<=ch&&ch<='9')
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(u) for(int i=h[u],v;v=e[i].t,i;i=e[i].n)
#define gc (_op==_ed&&(_ed=(_op=_buf)+fread(_buf,1,100000,stdin),_op==_ed)?EOF:*_op++)
char _buf[100000],*_op(_buf),*_ed(_buf);
I getint(){
	int _s=0,_f=1;char _ch=gc;
	while(!isnum(_ch))(_ch=='-')&&(_f=-1),_ch=gc;
	while(isnum(_ch))_s=_s*10+_ch-48,_ch=gc;
	return _s*_f;
}
const int N=2e5+1,mod=998244353;
V check(int&x){x-=mod,x+=x>>31&mod;}
V cmax(int&x,int y){if(x-y>>31)x=y;}
V cmin(int&x,int y){if(y-x>>31)x=y;}
ll n,m;
V input(){
	cin>>n;
	m=sqrt(n);
	FOR(i,1,m)if(n%i==0)
		cout<<i<<'\n';
	if(n/m==m)m--;
	ROF(i,m,1)if(n%i==0)
		cout<<n/i<<'\n';
}
V init(){
	
}
V work(){
	
}
int main(){
//	for(scanf("%d",&T);T--;){
		input();
		init();
		work();
//	}
	return 0;
}