#include #include #include #include #define LL long long #pragma comment(linker, "/STACK:102400000,102400000") using namespace std; const int mod = 1000000007; const int maxn = 212345; LL dp[maxn][2]; vector edge[maxn]; void Link(int st,int ed){ edge[st].push_back(ed); edge[ed].push_back(st); } void init(int n){ for(int i=1;i<=n;i++){ edge[i].resize(0); } } void dfs(int st,int fa){ dp[st][1] = 1; dp[st][0] = 1; for(vector::iterator it = edge[st].begin();it!=edge[st].end();it++){ int x = *it; if(x != fa){ dfs(x,st); (dp[st][1] *= dp[x][0] + 1) %= mod; (dp[st][1] += dp[st][0] * dp[x][1]) %= mod; (dp[st][0] *= dp[x][0] + 1) %= mod; } } } int main(){ int T; scanf("%d",&T); int n; while(T-- && ~scanf("%d",&n)){ init(n); int x; for(int i=1;i