#include <bits/stdc++.h>
using namespace std;
struct person {
  unordered_set<int> link;
  unordered_set<int> block;
  int group = -1;
};
unordered_set<int> CreateGroup(int start, int gindex, vector<person> &nodes) {
  stack<int> stackIndex;
  unordered_set<int> ret;
  stackIndex.push(start);
  while (!stackIndex.empty()) {
    int cur = stackIndex.top();
    ret.emplace(cur);
    nodes[cur].group = gindex;
    stackIndex.pop();
    for (const auto &next : nodes[cur].link) {
      if (ret.find(next) != ret.end()) continue;
      stackIndex.push(next);
    }
  }
  return ret;
}
int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<person> nodes(N + 1);
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    nodes[A].link.emplace(B);
    nodes[B].link.emplace(A);
  }
  for (int i = 0; i < K; i++) {
    int C, D;
    cin >> C >> D;
    nodes[C].block.emplace(D);
    nodes[D].block.emplace(C);
  }
  vector<unordered_set<int> > groups;
  int gcount = 0;
  for (int i = 1; i <= N; i++) {
    if (nodes[i].group != -1) continue;
    auto tempGroup = CreateGroup(i, gcount, nodes);
    if (tempGroup.empty()) continue;
    groups.emplace_back(tempGroup);
    ++gcount;
  }
  cout << gcount << endl;
  for (int i = 1; i < N + 1; i++) {
    int curGroup = nodes[i].group;
    if (curGroup == -1) {
      cout << "0 ";
      continue;
    }
    int blockNum = 0;
    for (const auto &blockIndex : nodes[i].block) {
      if (nodes[blockIndex].group == curGroup) ++blockNum;
    }
    int ret = groups[curGroup].size() - nodes[i].link.size() - blockNum - 1;
    cout << ret;
    if (i != N) cout << " ";
  }
  return 0;
}
