#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long fastpowMOD(long long a, long long p, long long MOD) {
  if (p == 0) return 1;
  long long z = fastpowMOD(a, p / 2, MOD);
  z = (z * z) % MOD;
  if (p % 2) z = (z * a) % MOD;
  return z;
}
bool seive[2005];
void SieveOfEratosthenes(long long n) {
  memset(seive, true, sizeof(seive));
  for (long long p = 2; p * p <= n; p++)
    if (seive[p] == true)
      for (long long i = p * p; i <= n; i += p) seive[i] = false;
}
long long fastpow(long long a, long long p) {
  if (p == 0) return 1;
  long long z = fastpow(a, p / 2);
  z = (z * z);
  if (p % 2) z = (z * a);
  return z;
}
long long n, i, ans = 0;
vector<long long> v[200005];
long long ver[200005] = {0}, val[200005] = {0}, odd = 0, even = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, i, j;
  cin >> n >> m;
  pair<long long, long long> a[n + 5], b[n + 5];
  for (i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    b[i].first = x;
    b[i].second = y;
    a[i].first = (x - y);
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  long long my[n + 5];
  for (i = 1; i <= n; i++) {
    my[a[i].second] = i;
  }
  long long ans[n + 5];
  long long pre = 0;
  long long suf = 0;
  for (i = 1; i <= n; i++) {
    pre += b[a[i].second].second;
  }
  for (i = 1; i <= n; i++) {
    ans[i] = (n - i) * b[a[i].second].first + (i - 1) * (b[a[i].second].second);
    ans[i] += suf;
    pre -= b[a[i].second].second;
    suf += b[a[i].second].first;
    ans[i] += pre;
  }
  for (i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    long long x1 = my[x];
    long long y1 = my[y];
    ans[x1] -= min(b[x].first + b[y].second, b[y].first + b[x].second);
    ans[y1] -= min(b[x].first + b[y].second, b[y].first + b[x].second);
  }
  for (i = 1; i <= n; i++) {
    cout << ans[my[i]] << " ";
  }
}
