#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  do {
    ret = ret * 10 + ch - '0';
    ch = getchar();
  } while ('0' <= ch && ch <= '9');
  return ret;
}
inline void write(int x) {
  if (!x) return;
  write(x / 10);
  putchar(x % 10 + '0');
}
int n, m, maxx;
int a[300100][2];
int b[300100];
int id[300100], rnk[300100];
bool cmp(int x, int y) { return b[x] < b[y]; }
long long xsum, ysum;
int size[300100];
long long sum[300100][2];
inline int lowbit(int x) { return x & -x; }
void insert(int x, int l, int r) {
  xsum += l;
  ysum += r;
  while (x <= n) {
    size[x]++;
    sum[x][0] += l;
    sum[x][1] += r;
    x += lowbit(x);
  }
}
int qsize(int x) {
  int ret = 0;
  while (x) {
    ret += size[x];
    x -= lowbit(x);
  }
  return ret;
}
long long query(int x, bool type) {
  long long ret = 0;
  while (x) {
    ret += sum[x][type];
    x -= lowbit(x);
  }
  return ret;
}
long long Ans[300100];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    b[i] = a[i][1] - a[i][0];
  }
  for (int i = 0; i < n; i++) id[i] = i;
  sort(id, id + n, cmp);
  rnk[id[0]] = 1;
  for (int i = 1; i < n; i++)
    rnk[id[i]] = rnk[id[i - 1]] + (b[id[i]] != b[id[i - 1]]);
  maxx = rnk[id[n - 1]];
  for (int i = 0; i < n; i++) insert(rnk[i], a[i][0], a[i][1]);
  for (int i = 0; i < n; i++) {
    int k = qsize(rnk[i] - 1);
    Ans[i] = (long long)a[i][0] * k + (long long)a[i][1] * (n - 1 - k) +
             query(rnk[i] - 1, 1) + (xsum - a[i][0] - query(rnk[i] - 1, 0));
  }
  for (int i = 0, u, v; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    if (rnk[u] < rnk[v]) {
      Ans[u] -= a[u][1] + a[v][0];
      Ans[v] -= a[u][1] + a[v][0];
    } else {
      Ans[u] -= a[u][0] + a[v][1];
      Ans[v] -= a[u][0] + a[v][1];
    }
  }
  for (int i = 0; i < n; i++) cout << Ans[i] << ' ';
  cout << endl;
  return 0;
}
