#include <bits/stdc++.h>
using namespace std;
long long int mod = 998244353;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
long long int binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long res = binpow(a, b / 2);
  if (b % 2)
    return res * res * a;
  else
    return res * res;
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<long long int> > x(n, vector<long long int>(4));
  vector<vector<long long int> > y(n, vector<long long int>(2));
  for (int i = 0; i < n; i++) {
    cin >> x[i][1] >> x[i][2];
    y[i][0] = x[i][1];
    y[i][1] = x[i][2];
    x[i][0] = x[i][1] - x[i][2];
    x[i][3] = i + 1;
  }
  vector<vector<int> > e(m, vector<int>(2));
  for (int i = 0; i < m; i++) {
    cin >> e[i][0] >> e[i][1];
  }
  sort(x.begin(), x.end());
  vector<long long int> pref(n), suff(n);
  pref[0] = x[0][1];
  suff[n - 1] = x[n - 1][2];
  for (int i = 1; i < n; i++) {
    pref[i] = pref[i - 1] + x[i][1];
    suff[n - i - 1] = suff[n - i] + x[n - i - 1][2];
  }
  vector<long long int> ans(n + 1);
  for (int i = 0; i < n; i++) {
    ans[x[i][3]] = (i > 0 ? pref[i - 1] : 0) + ((i * x[i][2])) +
                   ((i < n - 1) ? suff[i + 1] : 0) + ((n - i - 1) * x[i][1]);
  }
  for (int i = 0; i < m; i++) {
    long long int sc = min(y[e[i][0] - 1][0] + y[e[i][1] - 1][1],
                           y[e[i][0] - 1][1] + y[e[i][1] - 1][0]);
    ans[e[i][0]] -= sc;
    ans[e[i][1]] -= sc;
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int zz = 1; zz <= t; zz++) {
    solve();
  }
}
