#include <bits/stdc++.h>
using namespace std;
int n, k, m;
vector<pair<int, int> > A;
vector<pair<long long, long long> > Ft, Sd;
set<int> First, Second, Both;
long long FtSum, SdSum, BothSum;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  A.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i].first >> A[i].second;
    auto x = A[i];
    if (x.first < x.second) {
      Ft.push_back({x.second - x.first, 0});
      First.insert(i);
      FtSum += x.first;
    } else if (x.second < x.first) {
      Sd.push_back({x.first - x.second, 0});
      Second.insert(i);
      SdSum += x.second;
    } else {
      Both.insert(i);
      BothSum += x.second;
    }
  }
  sort(Ft.begin(), Ft.end());
  sort(Sd.begin(), Sd.end());
  for (int i = 0; i < Ft.size(); i++) {
    if (i) Ft[i].second = Ft[i - 1].second;
    Ft[i].second += Ft[i].first;
  }
  for (int i = 0; i < Sd.size(); i++) {
    if (i) Sd[i].second = Sd[i - 1].second;
    Sd[i].second += Sd[i].first;
  }
  vector<long long> F(n);
  for (int i = 0; i < n; i++) {
    if (A[i].first < A[i].second) {
      F[i] += SdSum + BothSum + FtSum;
      long long y = A[i].second - A[i].first;
      auto x = upper_bound(
          Ft.begin(), Ft.end(), y,
          [](int x, pair<long long, long long> y) { return x < y.first; });
      long long sum = 0;
      int cnt = -1;
      if (x != Ft.begin()) {
        x--;
        sum = x->second;
        cnt = x - Ft.begin();
      }
      F[i] += sum;
      F[i] += (Ft.size() - cnt - 1) * y;
      F[i] += 1ll * n * A[i].first;
      F[i] -= A[i].first + A[i].second;
    } else if (A[i].second < A[i].first) {
      F[i] += FtSum + BothSum + SdSum;
      long long y = A[i].first - A[i].second;
      auto x = upper_bound(
          Sd.begin(), Sd.end(), y,
          [](int x, pair<long long, long long> y) { return x < y.first; });
      long long sum = 0;
      int cnt = -1;
      if (x != Sd.begin()) {
        x--;
        sum = x->second;
        cnt = x - Sd.begin();
      }
      F[i] += sum;
      F[i] += (Sd.size() - cnt - 1) * y;
      F[i] += 1ll * n * A[i].second;
      F[i] -= A[i].first + A[i].second;
    } else {
      F[i] += FtSum + SdSum + BothSum;
      F[i] += 1ll * n * A[i].first;
      F[i] -= A[i].first + A[i].second;
    }
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    long long d = min(A[x].first + A[y].second, A[x].second + A[y].first);
    F[x] -= d;
    F[y] -= d;
  }
  for (long long x : F) cout << x << " ";
  cout << "\n"
       << "\n";
}
