#include <bits/stdc++.h>
using namespace std;
template <typename T>
T trace2(T a, T b) {
  cerr << a << " " << b << '\n';
}
template <typename T>
T trace3(T a, T b, T c) {
  cerr << a << " " << b << " " << c << '\n';
}
template <typename T>
T trace4(T a, T b, T c, T d) {
  cerr << a << " " << b << " " << c << " " << d << '\n';
}
template <typename T>
T trace5(T a, T b, T c, T d, T e) {
  cerr << a << " " << b << " " << c << " " << d << " " << e << '\n';
}
template <typename T>
T trace6(T a, T b, T c, T d, T e, T f) {
  cerr << a << " " << b << " " << c << " " << d << " " << e << " " << f << '\n';
}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
template <typename T>
T pow(T a, T b, long long int m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, m;
  cin >> n >> m;
  std::vector<pair<long long int, pair<long long int, long long int> > > v;
  std::vector<pair<long long int, long long int> > in;
  std::map<pair<long long int, long long int>, long long int> map;
  for (int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    in.push_back({x, y});
    v.push_back({(x - y), {x, y}});
    map[{x, y}] = i + 1;
  }
  std::vector<long long int> adj[n + 1];
  for (__typeof(m) i = (0) - ((0) > (m)); i != (m) - ((0) > (m));
       i += 1 - 2 * ((0) > (m))) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  sort(v.begin(), v.end());
  std::vector<long long int> x, y;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    x.push_back(v[i].second.first);
    y.push_back(v[i].second.second);
  }
  for (int i = 1; i < n; i++) {
    x[i] += x[i - 1];
  }
  for (int i = n - 2; i >= 0; i--) {
    y[i] += y[i + 1];
  }
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    long long int ans = 0;
    if ((i - 1) >= 0) {
      ans += x[i - 1];
    } else
      ans += 0;
    if ((i + 1) < n) {
      ans += y[i + 1];
    } else
      ans += 0;
    long long int pos = i + 1;
    ans += (pos - 1) * v[i].second.second;
    ans += (n - pos) * (v[i].second.first);
    long long int sub = 0;
    for (auto j : adj[map[v[i].second]]) {
      long long int x = v[i].second.first;
      long long int y = v[i].second.second;
      long long int xx = in[j - 1].first;
      long long int yy = in[j - 1].second;
      sub += ((x + yy) < (xx + y) ? (x + yy) : (xx + y));
    }
    map[{v[i].second.first, v[i].second.second}] = (ans - sub);
  }
  for (auto i : in) {
    cout << map[i] << " ";
  }
  return 0;
}
