#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int deep[maxn];
bool vis[maxn];
long long n, m;
vector<int> G[maxn];
int maxlen;
long long Size[maxn];
int flag;
void dfs(int x, int de) {
  Size[de]++;
  deep[x] = de;
  vis[x] = 1;
  maxlen = max(maxlen, de);
  for (int i : G[x]) {
    if (!vis[i])
      dfs(i, de + 1);
    else {
      if (abs(deep[x] - deep[i]) % 2 == 0) {
        flag++;
      }
    }
  }
}
void solve() {
  if (m == 0) {
    printf("3 %I64d\n", n * (n - 1) * (n - 2) / 3 / 2);
    return;
  }
  for (int i = 1; i <= n; i++) G[i].clear();
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
  memset(vis, 0, sizeof(vis));
  maxlen = 0;
  flag = 0;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i, 0);
  }
  if (flag > 0) {
    printf("0 1\n");
    return;
  } else {
    memset(Size, 0, sizeof(Size));
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) {
      maxlen = 0;
      if (!vis[i]) {
        dfs(i, 0);
        for (int i = 0; i <= maxlen; i++)
          if (Size[i] > 1) ans += (Size[i] - 1) * Size[i] / 2;
        for (int i = 2; i <= maxlen; i += 2)
          ans += Size[i - 2] * Size[i], Size[i] += Size[i - 2];
        for (int i = 3; i <= maxlen; i += 2)
          ans += Size[i - 2] * Size[i], Size[i] += Size[i - 2];
        for (int i = 0; i <= maxlen; i++) Size[i] = 0;
      }
    }
    if (ans > 0) printf("1 %I64d\n", ans);
  }
  if (!ans) printf("2 %I64d\n", m * (n - 2));
}
int main() {
  while (~scanf("%I64d%I64d", &n, &m)) solve();
  return 0;
}
