func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   inline int read() {     int s = 0, w = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) w |= (ch ==  - ), ch = getchar();     while (ch >=  0  && ch <=  9 ) s = s * 10 + ch -  0 , ch = getchar();     return w ? -s : s;   }   struct rr {     int nt, to;   } bl[100005 << 1];   int hd[100005], itot = 0;   inline void adde(int x, int y) {     bl[++itot] = (rr){hd[x], y};     hd[x] = itot;     bl[++itot] = (rr){hd[y], x};     hd[y] = itot;     return;   }   vector<int> to[100005];   int belong[100005], cnt = 0, sz[100005];   int dfn[100005], low[100005], num = 0, stk[100005], top = 0;   int vis[100005];   void tarjan(int u, int fa) {     dfn[u] = low[u] = ++num;     stk[++top] = u;     vis[u] = 1;     for (int i = hd[u], y; i; i = bl[i].nt)       if ((y = bl[i].to) != fa && vis[y] != 2) {         if (!dfn[y]) {           tarjan(y, u);           low[u] = min(low[u], low[y]);         } else           low[u] = min(low[u], dfn[y]);       }     if (dfn[u] == low[u]) {       int z;       ++cnt;       do {         z = stk[top--];         belong[z] = cnt;         sz[cnt]++;         vis[z] = 2;       } while (z != u);     }     return;   }   int n, m;   int dist[100005], sd[100005];   int f[100005][20], LOG[100005];   inline int LCA(int x, int y) {     if (sd[x] < sd[y]) swap(x, y);     for (int j = LOG[sd[x]]; j >= 0; --j)       if (f[x][j] && sd[f[x][j]] >= sd[y]) x = f[x][j];     if (x == y) return x;     for (int j = LOG[sd[x]]; j >= 0; --j)       if (f[x][j] && f[y][j] && f[x][j] != f[y][j]) x = f[x][j], y = f[y][j];     return f[x][0];   }   void dfs(int u, int fa) {     dist[u] = dist[fa] + (sz[u] != 1);     sd[u] = sd[fa] + 1;     f[u][0] = fa;     for (int j = 1; j <= LOG[sd[u]]; ++j) f[u][j] = f[f[u][j - 1]][j - 1];     for (int i = 0; i < to[u].size(); ++i)       if (to[u][i] != fa) dfs(to[u][i], u);     return;   }   int bin[100005];   int main() {     n = (read()), m = (read());     bin[0] = 1, bin[1] = 2;     for (int i = 2; i <= n; ++i) {       LOG[i] = LOG[i >> 1] + 1;       bin[i] = bin[i - 1] + bin[i - 1];       if (bin[i] >= mod) bin[i] -= mod;     }     for (int i = 1, x, y; i <= m; ++i) x = (read()), y = (read()), adde(x, y);     tarjan(1, 0);     for (int i = 1; i <= n; ++i)       for (int j = hd[i], y; j; j = bl[j].nt)         if (belong[i] != belong[y = bl[j].to]) to[belong[i]].push_back(belong[y]);     dfs(1, 0);     int q = (read()), x, y;     while (q--) {       x = belong[(read())], y = belong[(read())];       int lca = LCA(x, y);       printf( %d n , bin[dist[x] + dist[y] - dist[lca] - dist[f[lca][0]]]);     }     return 0;   }   