Problem: All Berland residents are waiting for an unprecedented tour of wizard in his Blue Helicopter over the cities of Berland!

It is well-known that there are n cities in Berland, some pairs of which are connected by bidirectional roads. Each pair of cities is connected by no more than one road. It is not guaranteed that the road network is connected, i.e. it is possible that you can't reach some city from some other.

The tour will contain several episodes. In each of the episodes:

  * the wizard will disembark at some city x from the Helicopter; 
  * he will give a performance and show a movie for free at the city x; 
  * he will drive to some neighboring city y using a road; 
  * he will give a performance and show a movie for free at the city y; 
  * he will drive to some neighboring to y city z; 
  * he will give a performance and show a movie for free at the city z; 
  * he will embark the Helicopter and fly away from the city z. 



It is known that the wizard doesn't like to use roads, so he agrees to use each road at most once (regardless of direction). In other words, for road between a and b he only can drive once from a to b, or drive once from b to a, or do not use this road at all.

The wizards wants to plan as many episodes as possible without violation the above rules. Help the wizard!

Please note that the wizard can visit the same city multiple times, the restriction is on roads only.

Input

The first line contains two integers n, m (1 ≤ n ≤ 2·105, 0 ≤ m ≤ 2·105) — the number of cities and the number of roads in Berland, respectively.

The roads description follow, one in each line. Each description is a pair of two integers ai, bi (1 ≤ ai, bi ≤ n, ai ≠ bi), where ai and bi are the ids of the cities connected by the i-th road. It is guaranteed that there are no two roads connecting the same pair of cities. Every road is bidirectional. The cities are numbered from 1 to n.

It is possible that the road network in Berland is not connected.

Output

In the first line print w — the maximum possible number of episodes. The next w lines should contain the episodes in format x, y, z — the three integers denoting the ids of the cities in the order of the wizard's visits.

Examples

Input

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


Output

2
1 4 2
4 3 2


Input

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


Output

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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename elemType>
inline void Read(elemType& T) {
  elemType X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  T = (w ? -X : X);
}
struct Graph {
  struct edge {
    int Next, to, w;
  };
  edge G[400010];
  int head[200010];
  int cnt;
  Graph() : cnt(2) {}
  void clear(int n) {
    cnt = 2;
    fill(head, head + n + 2, 0);
  }
  void add_edge(int u, int v) {
    G[cnt].w = 0;
    G[cnt].to = v;
    G[cnt].Next = head[u];
    head[u] = cnt++;
  }
};
Graph G;
vector<tuple<int, int, int> > List;
vector<int> root;
int fa[200010], dfn[200010];
pair<int, int> upLink[200010];
int n, m, Index = 0;
set<pair<int, int> > Set;
void DFS1(int u) {
  dfn[u] = ++Index;
  for (int i = G.head[u]; i; i = G.G[i].Next) {
    int v = G.G[i].to;
    if (fa[u] == v || G.G[i].w) continue;
    if (!dfn[v]) {
      fa[v] = u;
      DFS1(v);
    }
  }
  int p1 = 0, p1id = 0, p2 = 0, p2id = 0;
  for (int i = G.head[u]; i; i = G.G[i].Next) {
    int v = G.G[i].to;
    if (fa[u] == v || G.G[i].w || fa[v] == u) continue;
    if (dfn[v] < dfn[u]) {
      if (!p2) {
        p2 = v;
        p2id = i;
      } else {
        pair<int, int> e1 = make_pair(min(p2, u), max(p2, u));
        pair<int, int> e2 = make_pair(min(v, u), max(v, u));
        if (Set.count(e1))
          cout << "DFS1!!!!!!" << endl;
        else
          Set.insert(e1);
        if (Set.count(e2))
          cout << "DFS1!!!!!!" << endl;
        else
          Set.insert(e2);
        List.push_back(make_tuple(p2, u, v));
        G.G[p2id].w = G.G[p2id ^ 1].w = 1;
        G.G[i].w = G.G[i ^ 1].w = 1;
        p2 = p2id = 0;
      }
    } else {
      if (!p1) {
        p1 = v;
        p1id = i;
      } else {
        pair<int, int> e1 = make_pair(min(p1, u), max(p1, u));
        pair<int, int> e2 = make_pair(min(v, u), max(v, u));
        if (Set.count(e1))
          cout << "DFS1!!!!!!" << endl;
        else
          Set.insert(e1);
        if (Set.count(e2))
          cout << "DFS1!!!!!!" << endl;
        else
          Set.insert(e2);
        List.push_back(make_tuple(p1, u, v));
        G.G[p1id].w = G.G[p1id ^ 1].w = 1;
        G.G[i].w = G.G[i ^ 1].w = 1;
        p1 = p1id = 0;
      }
    }
  }
}
void DFS2(int u) {
  int down = 0, downId = 0, up = 0, upId = 0;
  for (int i = G.head[u]; i; i = G.G[i].Next) {
    int v = G.G[i].to;
    if (G.G[i].w || fa[u] == v) continue;
    if (fa[v] == u) {
      DFS2(v);
      continue;
    }
    if (dfn[v] > dfn[u]) {
      down = v;
      downId = i;
    } else {
      up = v;
      upId = i;
    }
  }
  if (down && up) {
    pair<int, int> e1 = make_pair(min(down, u), max(down, u));
    pair<int, int> e2 = make_pair(min(up, u), max(up, u));
    if (Set.count(e1))
      cout << "DFS2!!!!!!" << endl;
    else
      Set.insert(e1);
    if (Set.count(e2))
      cout << "DFS2!!!!!!" << endl;
    else
      Set.insert(e2);
    List.push_back(make_tuple(down, u, up));
    G.G[downId].w = G.G[downId ^ 1].w = 1;
    G.G[upId].w = G.G[upId ^ 1].w = 1;
    upLink[down] = make_pair(0, 0);
  } else if (up)
    upLink[u] = make_pair(up, upId);
}
void DFS3(int u) {
  int faId = 0;
  for (int i = G.head[u]; i; i = G.G[i].Next) {
    int v = G.G[i].to;
    if (fa[u] == v) {
      faId = i;
      continue;
    }
    if (G.G[i].w) continue;
    if (fa[v] == u) DFS3(v);
  }
  vector<pair<int, int> > temp;
  for (int i = G.head[u]; i; i = G.G[i].Next) {
    int v = G.G[i].to;
    if (G.G[i].w || fa[u] == v) continue;
    if (fa[v] == u) temp.push_back(make_pair(v, i));
  }
  if (upLink[u].first) {
    if (temp.empty()) {
      pair<int, int> e1 =
          make_pair(min(upLink[u].first, u), max(upLink[u].first, u));
      pair<int, int> e2 = make_pair(min(fa[u], u), max(fa[u], u));
      if (Set.count(e1)) {
        cout << G.G[upLink[u].second].w << " " << G.G[upLink[u].second ^ 1].w
             << " "
             << "DFS3A1!!!!!!" << endl;
      } else
        Set.insert(e1);
      if (Set.count(e2))
        cout << "DFS3A2!!!!!!" << endl;
      else
        Set.insert(e2);
      List.push_back(make_tuple(upLink[u].first, u, fa[u]));
      G.G[upLink[u].second].w = G.G[upLink[u].second ^ 1].w = 1;
      G.G[faId].w = G.G[faId ^ 1].w = 1;
      return;
    }
    pair<int, int> e1 =
        make_pair(min(upLink[u].first, u), max(upLink[u].first, u));
    pair<int, int> e2 =
        make_pair(min(temp.back().first, u), max(temp.back().first, u));
    if (Set.count(e1))
      cout << G.G[upLink[u].second].w << " " << G.G[upLink[u].second ^ 1].w
           << " "
           << "DFS3B1!!!!!" << endl;
    else
      Set.insert(e1);
    if (Set.count(e2))
      cout << "DFS3B2!!!!!!" << endl;
    else
      Set.insert(e2);
    List.push_back(make_tuple(upLink[u].first, u, temp.back().first));
    G.G[upLink[u].second].w = G.G[upLink[u].second ^ 1].w = 1;
    G.G[temp.back().second].w = G.G[temp.back().second ^ 1].w = 1;
    temp.pop_back();
  }
  for (int i = 1; i < temp.size(); i += 2) {
    pair<int, int> e1 =
        make_pair(min(temp[i - 1].first, u), max(temp[i - 1].first, u));
    pair<int, int> e2 = make_pair(min(temp[i].first, u), max(temp[i].first, u));
    if (Set.count(e1))
      cout << "DFS3C1!!!!!!" << endl;
    else
      Set.insert(e1);
    if (Set.count(e2))
      cout << "DFS3C2!!!!!!" << endl;
    else
      Set.insert(e2);
    List.push_back(make_tuple(temp[i - 1].first, u, temp[i].first));
    G.G[temp[i - 1].second].w = G.G[temp[i - 1].second ^ 1].w = 1;
    G.G[temp[i].second].w = G.G[temp[i].second ^ 1].w = 1;
  }
  if (temp.size() % 2 == 1 && fa[u]) {
    pair<int, int> e1 =
        make_pair(min(temp.back().first, u), max(temp.back().first, u));
    pair<int, int> e2 = make_pair(min(fa[u], u), max(fa[u], u));
    if (Set.count(e1))
      cout << "DFS3D1!!!!!!" << endl;
    else
      Set.insert(e1);
    if (Set.count(e2))
      cout << "DFS3D2!!!!!!" << endl;
    else
      Set.insert(e2);
    List.push_back(make_tuple(temp.back().first, u, fa[u]));
    G.G[temp.back().second].w = G.G[temp.back().second ^ 1].w = 1;
    G.G[faId].w = G.G[faId ^ 1].w = 1;
  }
}
int main() {
  Read(n);
  Read(m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    Read(u);
    Read(v);
    G.add_edge(u, v);
    G.add_edge(v, u);
  }
  for (int u = 1; u <= n; ++u)
    if (!dfn[u]) {
      DFS1(u);
      DFS2(u);
      DFS3(u);
    }
  printf("%d\n", List.size());
  for (auto v : List) printf("%d %d %d\n", get<0>(v), get<1>(v), get<2>(v));
  return 0;
}