#include <bits/stdc++.h>
using namespace std;
struct angka {
  long long int x, y;
  int pos;
};
struct angka node[300300];
long long int chaeng[300300], diff[300300], a[300300];
bool desc(struct angka a, struct angka b) { return (a.x - a.y) > (b.x - b.y); }
int main() {
  int n, i, j, k, x, y, ans, temp, curr, m;
  int tc;
  cin >> n >> m;
  long long int sum = 0;
  for (i = 1; i <= n; i++) {
    scanf("%lld %lld", &node[i].x, &node[i].y);
    node[i].pos = i;
    a[i] = node[i].x;
    diff[i] = node[i].x - node[i].y;
    sum += node[i].x;
  }
  sort(node + 1, node + n + 1, desc);
  long long int now = 0;
  for (i = 1; i <= n; i++) {
    int idx = node[i].pos;
    chaeng[idx] = sum + 1LL * (n - 2) * node[i].x;
    chaeng[idx] += -now;
    chaeng[idx] += -(node[i].x - node[i].y) * 1LL * (n - i);
    now += (node[i].x - node[i].y);
  }
  while (m--) {
    scanf("%d %d", &x, &y);
    long long int mini = max(diff[x], diff[y]);
    chaeng[x] -= a[x];
    chaeng[x] -= a[y];
    chaeng[x] += mini;
    chaeng[y] -= a[x];
    chaeng[y] -= a[y];
    chaeng[y] += mini;
  }
  for (i = 1; i <= n; i++) printf("%lld ", chaeng[i]);
  printf("\n");
  return 0;
}
