fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  5. #define int long long
  6.  
  7. bool isPrime(int x) {
  8. if (x < 2) return false;
  9. if (x % 2 == 0) return x == 2;
  10. for (int i = 3; i * i <= x; i += 2)
  11. if (x % i == 0) return false;
  12. return true;
  13. }
  14.  
  15. void solve() {
  16. int n;
  17. cin >> n;
  18.  
  19. if (n == 1) {
  20. cout << "FastestFinger\n";
  21. return;
  22. }
  23.  
  24. if (n == 2) {
  25. cout << "Ashishgup\n";
  26. return;
  27. }
  28.  
  29. if (n % 2 == 1) {
  30. cout << "Ashishgup\n";
  31. return;
  32. }
  33.  
  34. if ((n & (n - 1)) == 0) {
  35. cout << "FastestFinger\n";
  36. return;
  37. }
  38.  
  39. if ((n % 4 == 0) == false) {
  40. int p = n / 2;
  41. if (isPrime(p)) {
  42. cout << "FastestFinger\n";
  43. return;
  44. }
  45. }
  46.  
  47. cout << "Ashishgup\n";
  48. }
  49.  
  50. int32_t main() {
  51. fast_io;
  52. int t;
  53. cin >> t;
  54. while (t--) solve();
  55. return 0;
  56. }
  57.  
Success #stdin #stdout 0.01s 5296KB
stdin
7
1
2
3
4
5
6
12
stdout
FastestFinger
Ashishgup
Ashishgup
FastestFinger
Ashishgup
FastestFinger
Ashishgup