#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)

int n,m;
vector<int> G[20];
vector<bool> used(20,false);
vector<int> col(20,-1);

vector<int> vs;
void dfs(int v)
{
    if(used[v])return;
    used[v]=true;
    vs.push_back(v);
    for(int u:G[v])dfs(u);
}

ll now;
void dfs2(int i)
{
    if(i == (int)vs.size()){
        now++;
        return;
    }
    rep(c,3){
        col[vs[i]]=c;
        bool ok = true;
        for(int u:G[vs[i]]){
            if(col[u]==c)ok = false;
        }
        if(!ok)continue;
        dfs2(i+1);
    }
    col[vs[i]]=-1;
}
int main()
{
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans = 1;
    col = vector<int>(n,-1);
    rep(i,n){
        if(used[i])continue;
        ans*=3;
        vs = vector<int>();
        dfs(i);
        //col = vector<int>(20,-1);
        col[vs[0]]=0;
        now = 0;
        dfs2(1);
        ans*=now;
    }
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define int long long
const int MAXN = 2e1 + 5;

int fa[MAXN];
int find(int x) {
	return fa[x] == x ? x : fa[x] = find(fa[x]);
}
void merge(int x, int y) { 
    fa[find(y)] = find(x); 
}

vector<int> vec;
int res, col[MAXN];
int n, m, g[MAXN][MAXN];
void dfs(int k) {
	if (k == vec.size()) {
		++res;
		return ;
	}
	for (int i = 1; i <= 3; ++i) {
		int u = vec[k];
		col[u] = i;
		auto check = [](int x) -> bool {
			for (int i = 1; i <= n; ++i) 
				if (g[x][i] && col[i] == col[x])
					return false;
			return true;
		};
		if (check(vec[k])) dfs(k + 1);
		col[u] = 0;
	}
}
bool vis[MAXN];
signed main(int argc, char *argv[]) {
	//ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	for (int i = 0; i < MAXN; ++i) fa[i] = i;
	cin >> n >> m;
	while (m--) {
		int u, v;
		cin >> u >> v;
		merge(u, v);
		g[u][v] = g[v][u] = 1;
	}
	int ans = 1;
	for (int i = 1; i <= n; ++i) {
		if (vis[i]) continue;
		vec.clear(), res=  0;
		for (int j = 1; j <= n; ++j) 
			if (find(j) == i) vec.push_back(j), vis[j] = true;;
		dfs(0);
		ans *= res;
	}
	cout << ans << '\n';
	system("pause");
	return 0;
}