#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define dbg(x) (cout<<#x<<" = "<<(x)<<'\n')
const string problemName = "count";
const string inputFile = problemName + ".in";
const string outputFile = problemName + ".out";
typedef long long int lld;
typedef pair<int, int> PII;
typedef pair<int, lld> PIL;
typedef pair<lld, int> PLI;
typedef pair<lld, lld> PLL;
const int INF = (1LL << 31) - 1;
const lld LINF = (1LL << 62) - 1;
const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
const int NMAX = 30000 + 5;
int N, M, sol3, sol4;
unordered_set<int> V[NMAX];
PII sol;
int S[10];
inline bool check(int top, int x) {
for(int i = 1; i <= top; i++)
if(S[i] == x || !V[S[i]].count(x))
return 0;
return 1;
}
void back(int top, int x) {
S[top] = x;
if(top == 3)
sol3++;
if(top == 4) {
sol4++;
return;
}
for(auto y : V[x])
if(x < y && check(top, y))
back(top + 1, y);
}
int main() {
int i, x, y;
#ifndef ONLINE_JUDGE
freopen(inputFile.c_str(), "r", stdin);
freopen(outputFile.c_str(), "w", stdout);
#endif
scanf("%d%d", &N, &M);
for(i = 1; i <= M; i++) {
scanf("%d%d", &x, &y);
V[x].insert(y);
V[y].insert(x);
}
for(i = 1; i <= N; i++)
back(1, i);
sol = make_pair(1, N);
if(M)
sol = make_pair(2, M);
if(sol3)
sol = make_pair(3, sol3);
if(sol4)
sol = make_pair(4, sol4);
printf("%d %d\n", sol.first, sol.second);
return 0;
}