#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int INF = 1.01e9;
vector<int> e[N];
vector<vector<int>> answer;
int use[N];
int dfs(int v, int p) {
  use[v] = 1;
  vector<int> who;
  for (auto u : e[v]) {
    if (use[u] == 0) {
      if (dfs(u, v)) {
        who.push_back(u);
      }
    } else if (use[u] == 2) {
      who.push_back(u);
    }
  }
  use[v] = 2;
  int res = 1;
  if (p != -1 && who.size() % 2 == 1) {
    who.push_back(p);
    res = 0;
  }
  for (int i = 0; i + 1 < (int)who.size(); i += 2) {
    answer.push_back({who[i], v, who[i + 1]});
  }
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (m); i++) {
    int v, u;
    scanf("%d%d", &v, &u);
    v--;
    u--;
    e[v].push_back(u);
    e[u].push_back(v);
  }
  for (int i = 0; i < (n); i++) {
    if (!use[i]) {
      dfs(i, -1);
    }
  }
  printf("%d\n", (int)answer.size());
  for (auto x : answer) {
    for (auto y : x) {
      printf("%d ", y + 1);
    }
    puts("");
  }
  return 0;
}
