#include <bits/stdc++.h>
using namespace std;
long long mark[1000000], total[3000000];
int dfs(vector<int> v[], int num, int count) {
  mark[num] = count;
  total[count]++;
  int flag = 0;
  for (int i = 0; i < v[num].size(); i++) {
    int neighbour = v[num][i];
    if (count % 2 == 0) {
      if (mark[neighbour] == 0)
        flag |= dfs(v, neighbour, count + 1);
      else if (mark[neighbour] % 2 == 0)
        return 1;
    }
    if (count % 2 == 1) {
      if (mark[neighbour] == 0)
        flag |= dfs(v, neighbour, count - 1);
      else if (mark[neighbour] % 2 == 1)
        return 1;
    }
  }
  return flag;
}
int main() {
  long long n, m;
  cin >> n >> m;
  vector<int> v[n + 9];
  int hash[n + 9], flag = 0;
  memset(hash, 0, sizeof(hash));
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    if (hash[a] || hash[b]) flag = 1;
    hash[a]++;
    hash[b]++;
  }
  if (m == 0)
    cout << 3 << " " << (n * (n - 1) * (n - 2)) / 6 << endl;
  else if (!flag)
    cout << 2 << " " << m * (n - 2) << endl;
  else {
    int count = 1, flag = 0;
    for (int i = 1; i <= n; i++)
      if (mark[i] == 0) {
        flag |= dfs(v, i, 2 * count);
        ++count;
      }
    if (flag)
      cout << 0 << " " << 1 << endl;
    else {
      long long ans = 0;
      for (long long i = 1; i <= 2000000; i++)
        ans += (total[i] * (total[i] - 1)) / 2;
      cout << 1 << " " << ans << endl;
    }
  }
  return 0;
}
