#include <bits/stdc++.h>
#define f(i,j,k) for(long long i=j;i<k;i++)
#define f2(i,j,k) for(long long i=j;i>=k;i--)
#define ll long long 
using namespace std;
int main(){
    bool j=true;
    ll n,m,c,d;
    cin>>n>>m;
    ll a[n],b[n],ansa=0,ansb=0;
    vector <ll>now(n,0);
    f(i,0,n){
        cin>>a[i];
    }
    f(i,0,n){
        cin>>b[i];
        if(a[i]!=b[i]){
            j=false;
        }
    }
    f(i,0,m){
        cin>>c>>d;
        if(now[c-1]==0){
            ansa+=a[c-1];
            ansb+=b[c-1];
            now[c-1]++;
        }
        if(now[d-1]==0){
            ansa+=a[d-1];
            ansb+=b[d-1];
            now[d-1]++;
        }
    }
    if(ansa==ansb&&ansa!=0){
        cout<<"Yes"<<endl;
    }
    else if(j){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(n + 1);
  for (auto& e : a) cin >> e;

  for (int k = *max_element(a.begin(), a.end()); k >= 1; k--) {
    bool valid = true;
    for (int i = 0; valid && i < n; i++) {
      int l1 = a[i] / k, l2, l3;
      int r1 = a[i + 1] / k, r2, r3;
      l2 = l3 = l1;
      r2 = r3 = r1;
      if (a[i] % k > a[i + 1] % k) l2++;
      if (a[i] % k < a[i + 1] % k) r2++;
      if (a[i] % k != 0) l3++;
      if (a[i + 1] % k != 0) r3++;

      if (s[i] == '<') {
        valid = valid && l1 < r1 && l2 < r2 && l3 < r3;
      } else {
        valid = valid && l1 > r1 && l2 > r2 && l3 > r3;
      }
    }
    if (!valid) continue;

    cout << k << endl;
    for (int j = 0; j < k; j++) {
      for (int i = 0; i < n + 1; i++) cout << a[i] / k + (j < a[i] % k ? 1 : 0) << ' ';
      cout << endl;
    }
    return 0;
  }

  return 1;
}
