#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
string to_string(string s) { return '"' + s + '"'; }
string to_string(char s) { return string(1, s); }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A>
string to_string(A);
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool f = 1;
  string r = "{";
  for (const auto &x : v) {
    if (!f) r += ", ";
    f = 0;
    r += to_string(x);
  }
  return r + "}";
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
inline int mul(int a, int b) { return (int)((long long)a * b % MOD); }
inline int binpow(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b /= 2;
  }
  return res;
}
inline int inv(int a) { return binpow(a, MOD - 2); }
int gcd(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  int x1, y1;
  int d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
const int N = 2e5 + 5;
int n, m, k, deg[N], ans[N];
vector<pair<int, int> > edges;
set<int> g[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    edges.push_back({x, y});
    deg[x]++;
    deg[y]++;
    g[x].insert(y);
    g[y].insert(x);
  }
  int rem = n;
  queue<int> q;
  for (int i = 1; i <= n; ++i)
    if (deg[i] < k) {
      q.push(i);
      rem--;
    }
  for (int i = m - 1; i >= 0; --i) {
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (int u : g[v]) {
        deg[u]--;
        g[u].erase(v);
        if (deg[u] == k - 1) {
          q.push(u);
          rem--;
        }
      }
      deg[v] = 0;
      g[v].clear();
    }
    ans[i] = rem;
    int x = edges[i].first, y = edges[i].second;
    if (!g[x].count(y)) continue;
    deg[x]--;
    deg[y]--;
    g[x].erase(y);
    g[y].erase(x);
    if (deg[x] == k - 1) {
      q.push(x);
      rem--;
    }
    if (deg[y] == k - 1) {
      q.push(y);
      rem--;
    }
  }
  for (int i = 0; i < m; ++i) cout << ans[i] << "\n";
  return 0;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

There are n persons who initially don't know each other. On each morning, two of them, who were not friends before, become friends.

We want to plan a trip for every evening of m days. On each trip, you have to select a group of people that will go on the trip. For every person, one of the following should hold: 

  * Either this person does not go on the trip, 
  * Or at least k of his friends also go on the trip. 



Note that the friendship is not transitive. That is, if a and b are friends and b and c are friends, it does not necessarily imply that a and c are friends.

For each day, find the maximum number of people that can go on the trip on that day.

Input

The first line contains three integers n, m, and k (2 ≤ n ≤ 2 ⋅ 10^5, 1 ≤ m ≤ 2 ⋅ 10^5, 1 ≤ k < n) — the number of people, the number of days and the number of friends each person on the trip should have in the group.

The i-th (1 ≤ i ≤ m) of the next m lines contains two integers x and y (1≤ x, y≤ n, x≠ y), meaning that persons x and y become friends on the morning of day i. It is guaranteed that x and y were not friends before.

Output

Print exactly m lines, where the i-th of them (1≤ i≤ m) contains the maximum number of people that can go on the trip on the evening of the day i.

Examples

Input

4 4 2
2 3
1 2
1 3
1 4


Output

0
0
3
3


Input

5 8 2
2 1
4 2
5 4
5 2
4 3
5 1
4 1
3 2


Output

0
0
0
3
3
4
4
5


Input

5 7 2
1 5
3 2
2 5
3 4
1 2
5 3
1 3


Output

0
0
0
0
3
4
4

Note

In the first example, 

  * 1,2,3 can go on day 3 and 4. 



In the second example, 

  * 2,4,5 can go on day 4 and 5. 
  * 1,2,4,5 can go on day 6 and 7. 
  * 1,2,3,4,5 can go on day 8. 



In the third example, 

  * 1,2,5 can go on day 5. 
  * 1,2,3,5 can go on day 6 and 7. 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
string to_string(string s) { return '"' + s + '"'; }
string to_string(char s) { return string(1, s); }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A>
string to_string(A);
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool f = 1;
  string r = "{";
  for (const auto &x : v) {
    if (!f) r += ", ";
    f = 0;
    r += to_string(x);
  }
  return r + "}";
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
inline int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
inline int mul(int a, int b) { return (int)((long long)a * b % MOD); }
inline int binpow(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b /= 2;
  }
  return res;
}
inline int inv(int a) { return binpow(a, MOD - 2); }
int gcd(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  int x1, y1;
  int d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
const int N = 2e5 + 5;
int n, m, k, deg[N], ans[N];
vector<pair<int, int> > edges;
set<int> g[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    edges.push_back({x, y});
    deg[x]++;
    deg[y]++;
    g[x].insert(y);
    g[y].insert(x);
  }
  int rem = n;
  queue<int> q;
  for (int i = 1; i <= n; ++i)
    if (deg[i] < k) {
      q.push(i);
      rem--;
    }
  for (int i = m - 1; i >= 0; --i) {
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (int u : g[v]) {
        deg[u]--;
        g[u].erase(v);
        if (deg[u] == k - 1) {
          q.push(u);
          rem--;
        }
      }
      deg[v] = 0;
      g[v].clear();
    }
    ans[i] = rem;
    int x = edges[i].first, y = edges[i].second;
    if (!g[x].count(y)) continue;
    deg[x]--;
    deg[y]--;
    g[x].erase(y);
    g[y].erase(x);
    if (deg[x] == k - 1) {
      q.push(x);
      rem--;
    }
    if (deg[y] == k - 1) {
      q.push(y);
      rem--;
    }
  }
  for (int i = 0; i < m; ++i) cout << ans[i] << "\n";
  return 0;
}

```