首先分析一下,只有一种必胜态,那就是当x节点只连接一个节点时,那么下一个人必胜,然后不难想到每个人都不想对方先到必胜态,那么每个人都会一直取其他地方,直到x节点只剩一个连接节点,即判断 n − 2 n-2 n−2是奇数还是偶数
PS:当只有x一个节点时需要特判!
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <math.h>
#include <cstdio>
#include <string>
#include <bitset>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ins insert
#define lowbit(x) (x&(-x))
#define mkp(x,y) make_pair(x,y)
#define mem(a,x) memset(a,x,sizeof a);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> P;
const double eps=1e-8;
const double pi=acos(-1.0);
const int inf=0x3f3f3f3f;
const ll INF=1e18;
const int Mod=1e9+7;
const int maxn=2e5+10;
int degree[maxn];
int main(){
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int t,n,x;
cin>>t;
while(t--){
cin>>n>>x;
memset(degree,0,sizeof degree);
for(int i=1,u,v;i<n;i++){
cin>>u>>v;
degree[u]++,degree[v]++;
}
if(degree[x]==1 || degree[x]==0){
cout<<"Ayush\n";
}else{
int y=n-2;
if(y&1) cout<<"Ashish\n";
else cout<<"Ayush\n";
}
}
return 0;
}