#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
;
const int inf = 1e9 + 5;
const int mod = 1e9 + 7;
const int logN = 17;
int x, y, n, m, a[N], b[N], w[N], p[N], score[N];
vector<int> v[N];
long long ans[N], upsum[N], downsum[N];
bool cmp(int x, int y) { return score[x] < score[y]; }
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &a[i], &b[i]);
    score[i] = a[i] - b[i];
    p[i] = i;
  }
  sort(p + 1, p + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    w[p[i]] = i;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) upsum[i] = upsum[i - 1] + a[p[i]];
  for (int i = n; i >= 1; i--) downsum[i] = downsum[i + 1] + b[p[i]];
  for (int i = 1; i <= n; i++) {
    int up = i - 1;
    int down = n - i;
    long long ups = upsum[i - 1];
    long long dws = downsum[i + 1];
    int cur = p[i];
    for (auto go : v[cur]) {
      if (w[go] > i) {
        down--;
        dws -= b[go];
      } else {
        up--;
        ups -= a[go];
      }
    }
    ans[cur] = ups + dws + up * (long long)b[cur] + down * (long long)a[cur];
  }
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  cout << endl;
  return 0;
}
