#include <bits/stdc++.h>

using namespace std;

int main() {
  srand (clock());

  int n, m, e1, e2;
  cin >> n >> m >> e1 >> e2;
  vector<int> fertility(n), attractiveness(n), owner(n);
  vector<vector<int>> graph(n);
  for(int i = 0; i < n; i++) {
    cin >> fertility[i];
  }
  for(int i = 0; i < n; i++) {
    cin >> attractiveness[i];
  }
  for(int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  owner[e1] = 1;
  owner[e2] = -1;

  while(true) {
    int f1, f2;
    cin >> f1 >> f2;
    if (f1 == -1 || f2 == -1) {
      break;
    }

    vector<int> saplings(n);
    while(f1) {
      for(int tries = 0; tries < 100; tries++) {
        int node = rand() % n;
        if (owner[node] != 0) {
          continue;
        }
        bool possible = false;
        for(auto neighbor : graph[node]) {
          if (owner[neighbor] == 1) {
            possible = true;
          }
        }
        if (!possible) {
          continue;
        }
        saplings[node]++;
        break;
      }
      f1--;
    }

    for(int i = 0; i < n; i++) {
      cout << saplings[i] << " ";
    }
    cout << endl;

    for(int i = 0; i < n; i++) {
      int otherPlayer;
      cin >> otherPlayer >> owner[i];
    }
  }

  return 0;
}
