#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(__typeof__(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}



const int MOD = 1000000009;
const int MAX_V = 100100;
struct Graph {
    int V;
    vector<int> list[MAX_V];
    
    Graph(int n = 0) : V(n) {}
    void init(int n = 0) {V = n; for (int i = 0; i < MAX_V; ++i) list[i].clear();}
    inline vector<int>& operator [] (int i) {return list[i];}
    
    void connect(int f, int t) {
        list[f].push_back(t);
        list[t].push_back(f);
    }
} G;  


vector<vint> rem;

int N, M, x, y;
bool dame[MAX_V];
vint temp;
vector<vint> comp;


bool seen[MAX_V];
void dfs(int v) {
    seen[v] = true;
    for (int i = 0; i < rem[v].size(); ++i) {
        int next = rem[v][i];
        if (!seen[next]) dfs(next);
    }
    temp.PB(v);
}

int main() {
    memset(dame, 0, sizeof(dame));
    scanf("%d %d", &N, &M);
    G.init(N);
    for (int i = 0; i < M; ++i) {
        scanf("%d %d", &x, &y);
        --x; --y;
        G.connect(x, y);
    }
    
    for (int i = 0; i < N; ++i) {
        if (dame[i]) continue;

        for (int j = 0; j < G[i].size(); ++j) {
            int to = G[i][j];
            if (G[to].size() < G[i].size()) {
                dame[i] = true;
            }
            else if (G[to].size() > G[i].size()) {
                dame[to] = true;
            }
        }
    }
    
    rem.clear();
    rem.resize(N, vint());
    for (int i = 0; i < N; ++i) {
        if (dame[i]) continue;
        for (int j = 0; j < G[i].size(); ++j) {
            if (!dame[G[i][j]]) {
                rem[i].PB(G[i][j]);
            }
        }
    }
    
    //COUT(rem);
    
    memset(seen, 0, sizeof(seen));
    for (int i = 0; i < N; ++i) {
        if (!seen[i] && !dame[i]) {
            temp.clear();
            dfs(i);
            comp.PB(temp);
        }
    }
    
    //COUT(comp);
    
    int con = comp.size();
    ll res = 1;
    for (int i = 0; i < con; ++i) {
        res *= comp[i].size();
        res %= MOD;
    }
    
    cout << con << endl;
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 19720