#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>

#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define all(v) (v).begin(),(v).end()
#define debug(x) cout << #x << ": " << x << '\n';
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using P = pair<int,int>;
using PL = pair<ll, ll>;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct UnionFind {
  int n;
  vector<int> a;
  vector<int> sz;

  UnionFind(int _n) : n(_n), a(_n), sz(_n, 1) {
    for(int i = 0; i < _n; i++) a[i] = i;
  }

  int root(int x) { 
    if (a[x] == x) return x;
    return a[x] = root(a[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    if (sz[rx] < sz[ry]) swap(rx, ry);
    sz[rx] += sz[ry];
    a[ry] = rx;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }

  int size(int x) {
    return sz[root(x)];
  }

  map<int, vector<int>> groups() {
    map<int, vector<int>> group;    
    rep (i, n) root(i);
    rep (i, n) group[a[i]].push_back(i);
    return group;
  }
};


int main() {
  //cin.tie(0);ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15);
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  vector<int> a(N), b(N);
  rep (i, N) cin >> a[i];
  rep (i, N) cin >> b[i];

  rep (i, M) {
    int c, d;
    cin >> c >> d;
    --c; --d;
    uf.unite(c, d);
  }

  for (auto v : uf.groups()) {
    ll x = 0, y = 0;
    for (auto vv : v.second) {
      x += a[vv];
      y += b[vv];
    }
    if (x == y) continue;

    cout << "No" << endl;
    return 0;
  }

  cout << "Yes" << endl;
  return 0;
}

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
#define ll long long
#define ld long double
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());


long long powm(long long a, long long b,long long mod) {
long long res = 1;
while (b > 0) {
    if (b & 1)
        res = res * a %mod;
    a = a * a %mod;
    b >>= 1;
}

return res;
}

ll gcd(ll a, ll b)
{
if (b == 0)
    return a;
return gcd(b, a % b);      
}



signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);

#ifndef ONLINE_JUDGE
if(fopen("INPUT.txt","r"))
{
freopen("INPUT.txt","r",stdin);
freopen("OUTPUT.txt","w",stdout);
}
#endif
    

    int k,n,m;
    cin>>k>>n>>m;
    int a[k+1];
    for(int i=1;i<=k;i++)
        cin>>a[i];
    int l=0,r=1e18;

    int mnf=r+1;

    while(l<=r)
    {
        int mid=l+(r-l)/2;
        int mn[k+1]={0};
        int mx[k+1]={0};
        int tot1=0;
        int tot2=0;

        for(int i=1;i<=k;i++)
        {
            int z1=mid+a[i]*m;
            z1/=n;
            int z2=-mid+a[i]*m;
            z2=(z2+n-1)/n;
            mn[i]=max(0LL,z2);
            mx[i]=min(z1,m);
            tot1+=mx[i];
            tot2+=mn[i];
        }

        if(tot1>=m && m>=tot2)
        {
            mnf=min(mnf,mid);
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }
    }

    int mn[k+1];
    int mx[k+1];
    int sum1[k+1]={0};
    int sum2[k+1]={0};
    vector<int>ans;

    for(int i=1;i<=k;i++)
    {
        int z1=mnf+a[i]*m;
        z1/=n;
        int z2=-mnf+a[i]*m;
        z2=(z2+n-1)/n;
        mn[i]=max(0LL,z2);
        mx[i]=min(z1,m);
        sum1[i]=sum1[i-1]+mx[i];
        sum2[i]=sum2[i-1]+mn[i];
    }

    for(int i=k;i>=1;i--)
    {
        int z1=m-sum1[i-1];
        int z2=m-sum2[i-1];
        z1=max(mn[i],z1);
        z2=min(mx[i],z2);
        ans.push_back(z1);
        m-=z1;
    }

    reverse(ans.begin(),ans.end());
    for(auto i:ans)
        cout<<i<<" ";


    
}