#include <bits/stdc++.h>
using namespace std;
#define pi (3.141592653589)
#define mod 1000000007
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define fr(i, n) for(int i=n-1;i>=0;i--)
#define fo(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

int32_t main(){
fast

// Fuck Ratings, I'm in Love with Experience.
// Once a Charas, Always a CHARAS.
int t;
cin>>t;
while(t--){
    int n;
    cin>>n;
    if(n%2==1)
    {
        if(n==1)
        {
            cout<<"FastestFinger"<<endl;
        }
        else
        {
            cout<<"Ashishgup"<<endl;
        }
    }
    else if(n==2)
    {
        cout<<"Ashishgup"<<endl;
    }
    else if(n==4 || n==6 || n==8 ||n==10)
    {
        cout<<"FastestFinger"<<endl;
    }
    else
    {
        if(n%4==0 || n%6==0 || n%8==0 || n%10==0)
        {
            if(n%4==0){if((n/4)%2==1){cout<<"Ashishgup"<<endl;}}
            else if(n%6==0){if((n/6)%2==1){cout<<"Ashishgup"<<endl;}}
            else if(n%8==0){if((n/8)%2==1){cout<<"Ashishgup"<<endl;}}
            else if(n%10==0){if((n/10)%2==1){cout<<"Ashishgup"<<endl;}}
            else
            {
                cout<<"FastestFinger"<<endl;
            }
        }
        else
        {
            cout<<"FastestFinger"<<endl;
        }

    }

}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

vector<int>prime;
bool mark[N];

void sieve()
{
  int sq = sqrt(N); for (int i = 4; i <= N; i += 2)mark[i] = true;
  for (int i = 3; i <= sq; i += 2)if (!mark[i])for (ll j = i * i; j <= N; j += 2 * i)mark[j] = true;
  for (int i = 2; i <= N; i++)if (!mark[i])prime.push_back(i);
}
int primedivisors(int n) {
  int c = 0;
  for (int i = 0; prime[i]*prime[i] <= n; i++) {
    if (n % prime[i] == 0) {
      if(i!=0)++c;

      while (n % prime[i] == 0) {
        n /= prime[i];
      }
    }
  }
  if (n > 1) {
    ++c;
  }
  return c;
}

bool valid(int x) {
  for (int i = 2; i <= 30; ++i) {
    if (x == 1 << i) {
      return true;
    }
  }
  return false;
}

int main()
{
  sieve();
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      if( !mark[(n/2)] or valid(n)){
        printf("FastestFinger\n");
      }
      else{
        printf("Ashishgup\n" );
      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

bool valid(int x){
  for(int i=2;i<=30;++i){
    if(x == 1<<i){
      return true;
    }
  }
  return false;
}

int main()
{
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      bool f = false;
      for (int i = 3; i * i <= n; ++i) {
        int k = n / i;

        if ((i % 2 == 1 or k % 2 == 1) and valid(k)) {
          f = true;
          break;
        }
      }
      if (f) {
        printf("Ashishgup\n");
      }
      else {
        printf("FastestFinger\n");

      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

bool valid(int x) {
  for (int i = 2; i <= 30; ++i) {
    if (x == 1 << i) {
      return true;
    }
  }
  return false;
}

int main()
{
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    bool f = true;

    if(n%2 ==0){
      int k = n / 2;
      if(k==1)f=false;
      for (int i = 2; i * i <= k; ++i) {
        if (k % i == 0) {
          f = false;
          break;
        }
      }
    }
    else{
      f=false;
    }

    if (n == 1 or f or valid(n)) {
      printf("FastestFinger\n");
    }
    else {
      printf("Ashishgup\n");
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

vector<int>prime;
bool mark[N];

void sieve()
{
  int sq = sqrt(N); for (int i = 4; i <= N; i += 2)mark[i] = true;
  for (int i = 3; i <= sq; i += 2)if (!mark[i])for (ll j = i * i; j <= N; j += 2 * i)mark[j] = true;
  for (int i = 2; i <= N; i++)if (!mark[i])prime.push_back(i);
}
int primedivisors(int n) {
  int c = 0;
  for (int i = 0; prime[i]*prime[i] <= n; i++) {
    if (n % prime[i] == 0) {
      if(i!=0)++c;

      while (n % prime[i] == 0) {
        n /= prime[i];
      }
    }
  }
  if (n > 1) {
    ++c;
  }
  return c;
}

bool valid(int x) {
  for (int i = 2; i <= 30; ++i) {
    if (x == 1 << i) {
      return true;
    }
  }
  return false;
}

int main()
{
  sieve();
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      bool f=true;

      int k=n/2;
      for(int i=2;i*i<=k;++i){
        if(n%i==0){
          f=false;
          break;
        }
      }

      if(f or valid(n)){
        printf("FastestFinger\n");
      }
      else{
        printf("Ashishgup\n" );
      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

vector<int>prime;
bool mark[N];

void sieve()
{
  int sq = sqrt(N); for (int i = 4; i <= N; i += 2)mark[i] = true;
  for (int i = 3; i <= sq; i += 2)if (!mark[i])for (ll j = i * i; j <= N; j += 2 * i)mark[j] = true;
  for (int i = 2; i <= N; i++)if (!mark[i])prime.push_back(i);
}
int primedivisors(int n) {
  int c = 0;
  for (int i = 0; prime[i]*prime[i] <= n; i++) {
    if (n % prime[i] == 0) {
      if(i!=0)++c;

      while (n % prime[i] == 0) {
        n /= prime[i];
      }
    }
  }
  if (n > 1) {
    ++c;
  }
  return c;
}

bool valid(int x) {
  for (int i = 2; i <= 30; ++i) {
    if (x == 1 << i) {
      return true;
    }
  }
  return false;
}

int main()
{
  sieve();
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      if((n/2)%2 or valid(n)){
        printf("FastestFinger\n");
      }
      else{
        printf("Ashishgup\n" );
      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

vector<int>prime;
bool mark[N];

void sieve()
{
  int sq = sqrt(N); for (int i = 4; i <= N; i += 2)mark[i] = true;
  for (int i = 3; i <= sq; i += 2)if (!mark[i])for (ll j = i * i; j <= N; j += 2 * i)mark[j] = true;
  for (int i = 2; i <= N; i++)if (!mark[i])prime.push_back(i);
}
int primedivisors(int n) {
  int c = 0;
  for (int i = 0; prime[i]*prime[i] <= n; i++) {
    if (n % prime[i] == 0) {
      if(i!=0)++c;

      while (n % prime[i] == 0) {
        n /= prime[i];
      }
    }
  }
  if (n > 1) {
    ++c;
  }
  return c;
}

bool valid(int x) {
  for (int i = 2; i <= 30; ++i) {
    if (x == 1 << i) {
      return true;
    }
  }
  return false;
}

int main()
{
  sieve();
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      bool f=true;

      int k=n/2;
      for(int i=2;i*i<=n;++i){
        if(n%i==0){
          f=false;
          break;
        }
      }

      if(f or valid(n)){
        printf("FastestFinger\n");
      }
      else{
        printf("Ashishgup\n" );
      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

int main()
{
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      bool f = false;
      for (int i = 3; i * i <= n; ++i) {
        int k = n / i;

        if (i % 2 == 1 or k % 2 == 1 and k!=2) {
          f = true;
          break;
        }
      }
      if (f) {
        printf("Ashishgup\n");
      }
      else {
        printf("FastestFinger\n");

      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

bool valid(int x){
  for(int i=2;i<=30;++i){
    if(x == 1<<i){
      return true;
    }
  }
  return false;
}

int main()
{
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      bool f = false;
      for (int i = 3; i * i <= n; ++i) {
        int k = n / i;

        if (i%2==1 and valid(k)) {
          f=true;
          break;
        }
        if(k%2 == 1 and valid(i)){
          f=true;
          break;
        }
      }
      if (f) {
        printf("Ashishgup\n");
      }
      else {
        printf("FastestFinger\n");

      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}

template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind() {double x; scanf("%lf", &x); return x;}

///*....Bitmask....*///
int set_1(int n, int pos) {return n = (n | (1 << pos));}
int reset_0(int n, int pos) {return n = n & ~(1 << pos);}
bool check_bit(int n, int pos) {return n = n & (1 << pos);}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

vector<int>prime;
bool mark[N];

void sieve()
{
  int sq = sqrt(N); for (int i = 4; i <= N; i += 2)mark[i] = true;
  for (int i = 3; i <= sq; i += 2)if (!mark[i])for (ll j = i * i; j <= N; j += 2 * i)mark[j] = true;
  for (int i = 2; i <= N; i++)if (!mark[i])prime.push_back(i);
}
int primedivisors(int n) {
  int c = 0;
  for (int i = 0; prime[i]*prime[i] <= n; i++) {
    if (n % prime[i] == 0) {
      if(i!=0)++c;

      while (n % prime[i] == 0) {
        n /= prime[i];
      }
    }
  }
  if (n > 1) {
    ++c;
  }
  return c;
}

bool valid(int x) {
  for (int i = 2; i <= 30; ++i) {
    if (x == 1 << i) {
      return true;
    }
  }
  return false;
}

int main()
{
  sieve();
  int t = 1, te = 0;
  Int(t);
  while (t--) {
    int n;
    Int(n);

    if (n == 1) {
      printf("FastestFinger\n");
    }
    else if (n == 2) {
      printf("Ashishgup\n");
    }
    else if (n % 2) {
      printf("Ashishgup\n");
    }
    else {
      bool f=true;

      int k=n/2;
      for(int i=2;i*i<=n;++i){
        if(n%i==0){
          return false;
        }
      }

      if(f or valid(n)){
        printf("FastestFinger\n");
      }
      else{
        printf("Ashishgup\n" );
      }
    }

    //printf("Case %d: ",++te);
  }
  return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) (void)0
#endif

using ll = long long;
using pii = pair<int, int>;

const int N = (int)1e6 + 10;
int n;
char str[N];
vector <int> stars;
vector <int> ps;
bool has_stars[N];

void solve_one()
{
	int cnt_left = 0, cnt_right = 0;
	int pos_left = ps[0], pos_right = ps[0];
	for (int x : stars)
	{
		if (x < ps[0])
		{
			cnt_left++;
			pos_left = min(pos_left, x);
		}
		else
		{
			cnt_right++;
			pos_right = max(pos_right, x);
		}
	}
	auto v1 = make_pair(cnt_left, -(ps[0] - pos_left));
	auto v2 = make_pair(cnt_right, -(pos_right - ps[0]));
	auto result = max(v1, v2);
	printf("%d %d\n", result.first, -result.second);
}

void adjust_ps(int len, int &it, int &r)
{
	while (it < (int)ps.size() && ps[it] <= r)
	{
		r = ps[it] + len;
		it++;
	}
}
void adjust_stars(int len, int &it, int &r)
{
	while (it < (int)stars.size() && stars[it] <= r)
	{
		it++;
	}
}

bool check(int len)
{
	int right_border = -1;
	int p_it = 0, s_it = 0;
	while (s_it < (int)stars.size())
	{
		adjust_ps(len, p_it, right_border);
		adjust_stars(len, s_it, right_border);
		if (s_it == (int)stars.size())
			break;
		if (p_it < (int)ps.size() && ps[p_it] < stars[s_it])
		{
			right_border = ps[p_it];
			continue;
		}

		if (p_it == (int)ps.size())
			return false;
		int p1 = ps[p_it];
		if (p1 > stars[s_it] + len)
			return false;

		if (p_it == (int)ps.size() - 1)
			right_border = ps[p_it++];
		else
		{
			int p2 = ps[p_it + 1];
			if (p2 > stars[s_it] + len)
				right_border = ps[p_it++];
			else
			{
				if (has_stars[p_it])
					right_border = p1 + len;
				else
					right_border = p2 + len;
				p_it += 2;
			}
		}
		s_it++;
	}
	return true;
}

void solve_many()
{
	int l = 1, r = n;
	while (r - l > 1)
	{
		int mid = (l + r) / 2;
		if (check(mid))
			r = mid;
		else
			l = mid;
	}
	printf("%d %d\n", (int)stars.size(), r);
}

void solve()
{
	scanf("%d", &n);
	scanf(" %s", str);
	for (int i = 0; i < n; i++)
	{
		if (str[i] == 'P')
			ps.push_back(i);
		else if (str[i] == '*')
			stars.push_back(i);
	}
	for (int i = 0; i < (int)ps.size() - 1; i++)
	{
		auto it = lower_bound(stars.begin(), stars.end(), ps[i]);
		if (it != stars.end() && *it < ps[i + 1])
			has_stars[i] = true;
	}
	if (ps.size() == 1)
		solve_one();
	else
		solve_many();
}

int main()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("err.txt", "w", stderr);
#endif

	solve();

	eprintf("\n\ntime = %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=1000005;
const int INF=0x3f3f3f3f;
char str[MAXN];
int dp[MAXN][2],rig[MAXN];
bool check(int n,int m,vector<int> &packman)
{
    int t=(int)packman.size();
    for(int i=0;i<t;i++)
    {
        int p=packman[i];
        if(i==0)
        {
            if(rig[0]<p)
            {
                if(p<=rig[0]+m)dp[i][0]=rig[p];
                else dp[i][0]=rig[0];
                dp[i][1]=rig[0];
            }
            else
            {
                dp[i][0]=rig[p];
                dp[i][1]=rig[min(n,p+m)];
            }
        }
        else
        {
            dp[i][0]=dp[i][1]=-INF;
            if(dp[i-1][0]<p)
            {
                if(p<=dp[i-1][0]+m)dp[i][0]=max(dp[i][0],rig[p]);
                else dp[i][0]=max(dp[i][0],dp[i-1][0]);
                dp[i][1]=max(dp[i][1],dp[i-1][0]);
            }
            else
            {
                dp[i][0]=max(dp[i][0],rig[p]);
                dp[i][1]=max(dp[i][1],rig[min(n,p+m)]);
            }

            int q=packman[i-1];
            if(dp[i-1][1]<q)
            {
                if(p<=dp[i-1][1]+m)dp[i][0]=max(dp[i][0],rig[min(n,m+q)]);
                dp[i][1]=max(dp[i][1],dp[i-1][1]);
            }
            else if(dp[i-1][1]<p)
            {
                if(p<=dp[i-1][1]+m)dp[i][0]=max(dp[i][0],rig[p]);
                else dp[i][0]=max(dp[i][0],dp[i-1][1]);
                dp[i][1]=max(dp[i][1],dp[i-1][1]);
            }
            else
            {
                dp[i][0]=max(dp[i][0],rig[p]);
                dp[i][1]=max(dp[i][1],rig[min(n,p+m)]);
            }
        }
    }
    return max(dp[t-1][0],dp[t-1][1])>n;
}
int main()
{
    int n;
    scanf("%d%s",&n,str+1);
    vector<int> asterisk,packman;
    for(int i=1;i<=n;i++)
    {
        if(str[i]=='*')asterisk.push_back(i);
        if(str[i]=='P')packman.push_back(i);
    }
    if((int)packman.size()==1)
    {
        int cnt[2]={0,0};
        for(int i=0;i<(int)asterisk.size();i++)
            cnt[asterisk[i]>packman[0]]++;
        int dis[2]={packman[0]-asterisk.front(),asterisk.back()-packman[0]};
        if(cnt[0]>cnt[1])printf("%d %d\n",cnt[0],dis[0]);
        else if(cnt[0]<cnt[1])printf("%d %d\n",cnt[1],dis[1]);
        else printf("%d %d\n",cnt[0],min(dis[0],dis[1]));
        return 0;
    }
    for(int i=n,j=n+1;i>=0;i--)
    {
        rig[i]=j;
        if(str[i]=='*')j=i;
    }
    int l=1,r=n;
    while(l<r)
    {
        int m=(l+r)/2;
        if(check(n,m,packman))r=m;
        else l=m+1;
    }
    return 0*printf("%d %d\n",(int)asterisk.size(),l);
}


#include<cstdio>
#include<cctype>

#define maxn 1001001

inline int read(){
	int r=0,f=0;
	char c;
	while(!isdigit(c=getchar()))f|=(c=='-');
	while(isdigit(c))r=(r<<1)+(r<<3)+(c^48),c=getchar();
	return f?-r:r;
}

inline int min(int a,int b){
	return a<b?a:b;
}

int n,cnt,suf[maxn];

bool f[maxn];

char s[maxn];

namespace one{

	int st,ed;

	inline void work(){
		int sum=0;
		int anss=0,t=0;
		for(int i=1;i<=n;i++)
			if(!st&&s[i]=='*')st=i;
		for(int i=n;i>=1;i--)
			if(!ed&&s[i]=='*')ed=i;
		for(int i=1;i<=n;i++){
			sum+=(s[i]=='*');
			if(s[i]!='P')continue;
			if(sum!=cnt-sum){
				if(sum>cnt-sum)anss=sum,t=i-st;
				else anss=cnt-sum,t=ed-i;
			}
			else {
				anss=sum;
				t=min(i-st,ed-i);
			}
			break;
		}
		printf("%d %d\n",anss,t);
	}

}

inline bool check(int tim){
	for(int i=1;i<=n;i++)f[i]=0;
	for(int i=1;i<=n;i++){
		if(!f[i-1])continue;
		if(s[i]=='.')f[i]=1;
		else if(s[i]=='P')f[min(min(i+tim,suf[i]-1),n)]=1;
		else if(suf[i]-i<=tim){
			f[suf[i]]=1;
			if(suf[suf[i]]-i>tim)continue;
			f[min(min(suf[i]+tim,suf[suf[suf[i]]]-1),n)]=1;
		}
	}
	return f[n];
}

int main(){
	scanf("%d\n",&n);
	scanf("%s",s+1);
	int is_one=1;
	for(int i=1;i<=n;i++){
		is_one-=(s[i]=='P');
		cnt+=(s[i]=='*');
	}
	if(!is_one){
		one::work();
		return 0;
	}
	suf[n+1]=1e9;
	for(int i=n;i>=1;i--){
		suf[i]=suf[i+1];
		if(s[i+1]=='P')suf[i]=i+1;
	}
	f[0]=1;
	int l=0,r=n+1;
	while(l+1<r){
		int mid=(l+r)>>1;
		if(check(mid))r=mid;
		else l=mid;
	}
	printf("%d %d\n",cnt,r);
	return 0;
}


#include<cstdio>
#include<cctype>

#define maxn 1001001

inline int read(){
	int r=0,f=0;
	char c;
	while(!isdigit(c=getchar()))f|=(c=='-');
	while(isdigit(c))r=(r<<1)+(r<<3)+(c^48),c=getchar();
	return f?-r:r;
}

inline int min(int a,int b){
	return a<b?a:b;
}

int n,cnt,suf[maxn];

bool f[maxn];

char s[maxn];

namespace one{

	int st,ed;

	inline void work(){
		int sum=0;
		int anss=0,t=0;
		for(int i=1;i<=n;i++)
			if(!st&&s[i]=='*')st=i;
		for(int i=n;i>=1;i--)
			if(!ed&&s[i]=='*')ed=i;
		for(int i=1;i<=n;i++){
			sum+=(s[i]=='*');
			if(s[i]!='P')continue;
			if(sum!=cnt-sum){
				if(sum>cnt-sum)anss=sum,t=i-st;
				else anss=cnt-sum,t=ed-i;
			}
			else {
				anss=sum;
				t=min(i-st,ed-i);
			}
			break;
		}
		printf("%d %d\n",anss,t);
	}

}

inline bool check(int tim){
	for(int i=1;i<=n;i++)f[i]=0;
	for(int i=1;i<=n;i++){
		if(!f[i-1])continue;
		if(s[i]=='.')f[i]=1;
		else if(s[i]=='P')f[min(min(i+tim,suf[i]-1),n)]=1;
		else if(suf[i]-i<=tim){
			f[suf[i]]=1;
			if(suf[suf[i]]-i>tim)continue;
			f[min(min(suf[i]+tim,suf[suf[suf[i]]]-1),n)]=1;
		}
	}
	return f[n];
}

int main(){
	scanf("%d\n",&n);
	scanf("%s",s+1);
	int is_one=1;
	for(int i=1;i<=n;i++){
		is_one-=(s[i]=='P');
		cnt+=(s[i]=='*');
	}
	if(!is_one){
		one::work();
		return 0;
	}
	suf[n+1]=1e9;
	for(int i=n;i>=1;i--){
		suf[i]=suf[i+1];
		if(s[i+1]=='P')suf[i]=i+1;
	}
	f[0]=1;
	int l=0,r=n+1;
	while(l+1<r){
		int mid=(l+r)>>1;
		if(check(mid))r=mid;
		else l=mid;
	}
	printf("%d %d",cnt,r);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std ;

const int N=1000100;
char grass[N];
int len,n,rg,lg,p,sum[N],vis[N],peo[N];

void init()
{
	scanf("%d",&n);
	scanf("%s",grass);
	len=n;
}

bool check(int time)
{
	memset(vis,0,sizeof vis);
	if (sum[peo[0]]>0)
	{
		if (peo[0]-time-1>=0&&sum[peo[0]-time-1]>0)
			return false;
		vis[0]=peo[0];
		if (peo[1]-time<=0||sum[peo[1]-time-1]<=0)
			vis[1]=max(vis[1],peo[0]+time);
	}
	else
		vis[0]=peo[0]+time;
	if (vis[0]>=rg) return true;
	for (int i=1;i<p;i++)
	{
		if (vis[i]>n) return true;
		if (sum[peo[i]]-sum[vis[i-1]]>0)
		{
			if (peo[i]-time-1>=0&&sum[peo[i]-time-1]-sum[vis[i-1]]>0)
				return false;
			vis[i]=max(vis[i],peo[i]);
			if (i+1!=p&&(peo[i+1]-time<=0||sum[peo[i+1]-time-1]-sum[vis[i-1]]<=0))
				vis[i+1]=max(vis[i+1],peo[i]+time);
		}
		else
			vis[i]=max(vis[i],peo[i]+time);
		if (vis[i]>=rg) return true;
	}
	return vis[p-1]>=rg;
}

void solve()
{
	int pos=0;
	p=sum[0]=0;
	rg=-1,lg=-1;
	for (int i=0;i<len;i++)
	{
		if (grass[i]=='P')
		{
			if (!p) pos=i;
			peo[p++]=i;
		}
		if (grass[i]=='*')
		{
			if (lg==-1) lg=i;
			rg=i;
			sum[i]++;
		}
		if (i) sum[i]+=sum[i-1];
	}
	n=len-1;
	if ((rg==-1)||(!p))
	{
		printf("0 0\n");
		return ;
	}
	if (p==1)
	{
		if (sum[pos]>=sum[n]-sum[pos])
		{
			if (sum[pos]==sum[n]-sum[pos])
				printf("%d %d\n",sum[pos],min(pos-lg,rg-pos));
			else
				printf("%d %d\n",sum[pos],pos-lg);
		}
		else
			printf("%d %d\n",sum[n]-sum[pos],rg-pos);
		return ;
	}
	int l=0,r=len+5;
	while (l<r)
	{
		int mid=(l+r)>>1;
		if (check(mid))
			r=mid;
		else
			l=mid+1;
	}
	printf("%d %d\n",sum[n],r);
}

int main()
{
//	freopen("2326.in","r",stdin);
//	freopen("2326.out","w",stdout);
	init();
	solve();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std ;

const int N=1000100;
char grass[N];
int len,n,rg,p,sum[N],vis[N],peo[N];

void init()
{
	scanf("%d",&n);
	scanf("%s",grass);
	len=n;
}

bool check(int time)
{
	memset(vis,0,sizeof vis);
	if (sum[peo[0]]>0)
	{
		if (peo[0]-time-1>=0&&sum[peo[0]-time-1]>0)
			return false;
		vis[0]=peo[0];
		if (peo[1]-time<=0||sum[peo[1]-time-1]<=0)
			vis[1]=max(vis[1],peo[0]+time);
	}
	else
		vis[0]=peo[0]+time;
	if (vis[0]>=rg) return true;
	for (int i=1;i<p;i++)
	{
		if (vis[i]>n) return true;
		if (sum[peo[i]]-sum[vis[i-1]]>0)
		{
			if (peo[i]-time-1>=0&&sum[peo[i]-time-1]-sum[vis[i-1]]>0)
				return false;
			vis[i]=max(vis[i],peo[i]);
			if (i+1!=p&&(peo[i+1]-time<=0||sum[peo[i+1]-time-1]-sum[vis[i-1]]<=0))
				vis[i+1]=max(vis[i+1],peo[i]+time);
		}
		else
			vis[i]=max(vis[i],peo[i]+time);
		if (vis[i]>=rg) return true;
	}
	return vis[p-1]>=rg;
}

void solve()
{
	int pos=0;
	p=sum[0]=0;
	rg=-1;
	for (int i=0;i<len;i++)
	{
		if (grass[i]=='P')
		{
			if (!p) pos=i;
			peo[p++]=i;
		}
		if (grass[i]=='*')
		{
			rg=i;
			sum[i]++;
		}
		if (i) sum[i]+=sum[i-1];
	}
	n=len-1;
	if ((rg==-1)||(!p))
	{
		printf("0 0\n");
		return ;
	}
	if (p==1)
	{
		if (sum[pos]>=sum[n]-sum[pos])
		{
			if (sum[pos]==sum[n]-sum[pos])
				printf("%d %d\n",sum[pos],min(pos,n-pos));
			else
				printf("%d %d\n",sum[pos],pos);
		}
		else
			printf("%d %d\n",sum[n]-sum[pos],n-pos);
		return ;
	}
	int l=0,r=len+5;
	while (l<r)
	{
		int mid=(l+r)>>1;
		if (check(mid))
			r=mid;
		else
			l=mid+1;
	}
	printf("%d %d\n",sum[n],r);
}

int main()
{
//	freopen("2326.in","r",stdin);
//	freopen("2326.out","w",stdout);
	init();
	solve();
	return 0;
}


/*
Contest: -
Problem: NFLSOJ 712
Author: tzc_wk
Time: 2020.10.20
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define pb			push_back
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define y1			y1010101010101
#define y0			y0101010101010
typedef pair<int,int> pii;
typedef long long ll;
int n;char s[1000005];
int posd[1000005],cntd=0;
int posb[1000005],cntb=0;
int dp[1000005];
int hav[1000005];
inline bool check(int mid){
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=cntd;i++){
		if(dp[i-1]>=posd[i]||hav[posd[i]-1]==hav[posd[i-1]]) dp[i]=max(dp[i],posd[i]+mid);
		if(dp[i-1]>=posd[i]-mid||hav[posd[i]-mid-1]==hav[dp[i-1]]) dp[i]=max(dp[i],posd[i]);
		else return 0;
		if(i>=2&&(dp[i-2]>=min(posd[i-1],posd[i]-mid-1)||hav[dp[i-2]]==hav[min(posd[i-1],posd[i]-mid)-1]))
			dp[i]=max(dp[i],max(posd[i],posd[i-1]+mid));
		dp[i]=min(dp[i],n);
//		printf("%d %d\n",i,dp[i]);
	}
	if(hav[dp[cntd]]==hav[n]) return 1;
	return 0;
}
int main(){
	scanf("%d%s",&n,s+1);
	for(int i=1;i<=n;i++) if(s[i]=='P') posd[++cntd]=i;
	for(int i=1;i<=n;i++) if(s[i]=='*') posb[++cntb]=i;
	posb[cntb+1]=n+1;
	for(int i=0;i<=cntb;i++){
		for(int j=posb[i];j<posb[i+1];j++) hav[j]=i;
	}
	if(cntd==1){
		int cntl=0,cntr=0,mxl=0,mxr=0;
		for(int i=1;i<=posd[1];i++) if(s[i]=='*') cntl++,mxl=max(mxl,posd[1]-i);
		for(int i=posd[1];i<=n;i++) if(s[i]=='*') cntr++,mxr=max(mxr,i-posd[1]);
		if(cntl>cntr) printf("%d %d\n",cntl,mxl);
		else if(cntr>cntr) printf("%d %d\n",cntr,mxr);
		else printf("%d %d\n",cntl,min(mxl,mxr));
		return 0;
	}
//	check(4);
	int l=1,r=n,ans=-23987;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d %d\n",cntb,ans);
	return 0;
}


/*
Contest: -
Problem: NFLSOJ 712
Author: tzc_wk
Time: 2020.10.20
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define pb			push_back
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define y1			y1010101010101
#define y0			y0101010101010
typedef pair<int,int> pii;
typedef long long ll;
int n;char s[1000005];
int posd[1000005],cntd=0;
int posb[1000005],cntb=0;
int dp[1000005];
int hav[1000005];
inline bool check(int mid){
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=cntd;i++){
		if(dp[i-1]>=posd[i]||hav[posd[i]-1]==hav[dp[i-1]]) dp[i]=max(dp[i],posd[i]+mid);
		if(dp[i-1]>=posd[i]-mid||hav[posd[i]-mid-1]==hav[dp[i-1]]) dp[i]=max(dp[i],posd[i]);
		else return 0;
		if(i>=2&&(dp[i-2]>=min(posd[i-1],posd[i]-mid-1)||hav[dp[i-2]]==hav[min(posd[i-1],posd[i]-mid)-1]))
			dp[i]=max(dp[i],max(posd[i],posd[i-1]+mid));
		dp[i]=min(dp[i],n);
//		printf("%d %d\n",i,dp[i]);
	}
	if(hav[dp[cntd]]==hav[n]) return 1;
	return 0;
}
int main(){
	scanf("%d%s",&n,s+1);
	for(int i=1;i<=n;i++) if(s[i]=='P') posd[++cntd]=i;
	for(int i=1;i<=n;i++) if(s[i]=='*') posb[++cntb]=i;
	posb[cntb+1]=n+1;
	for(int i=0;i<=cntb;i++){
		for(int j=posb[i];j<posb[i+1];j++) hav[j]=i;
	}
	if(cntd==1){
		int cntl=0,cntr=0,mxl=0,mxr=0;
		for(int i=1;i<=posd[1];i++) if(s[i]=='*') cntl++,mxl=max(mxl,posd[1]-i);
		for(int i=posd[1];i<=n;i++) if(s[i]=='*') cntr++,mxr=max(mxr,i-posd[1]);
		if(cntl>cntr) printf("%d %d\n",cntl,mxl);
		else if(cntr>cntl) printf("%d %d\n",cntr,mxr);
		else printf("%d %d\n",cntl,min(mxl,mxr));
		return 0;
	}
//	check(3);
	int l=1,r=n,ans=-23987;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d %d\n",cntb,ans);
	return 0;
}


/*
Contest: -
Problem: NFLSOJ 712
Author: tzc_wk
Time: 2020.10.20
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define pb			push_back
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define y1			y1010101010101
#define y0			y0101010101010
typedef pair<int,int> pii;
typedef long long ll;
int n;char s[1000005];
int posd[1000005],cntd=0;
int posb[1000005],cntb=0;
int dp[1000005];
int hav[1000005];
inline bool check(int mid){
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=cntd;i++){
		if(dp[i-1]>=posd[i]||hav[posd[i]-1]==hav[posd[i-1]]) dp[i]=max(dp[i],posd[i]+mid);
		if(dp[i-1]>=posd[i]-mid||hav[posd[i]-mid-1]==hav[dp[i-1]]) dp[i]=max(dp[i],posd[i]);
		else return 0;
		if(i>=2&&(dp[i-2]>=min(posd[i-1],posd[i]-mid-1)||hav[dp[i-2]]==hav[min(posd[i-1],posd[i]-mid)-1]))
			dp[i]=max(dp[i],max(posd[i],posd[i-1]+mid));
		dp[i]=min(dp[i],n);
//		printf("%d %d\n",i,dp[i]);
	}
	if(hav[dp[cntd]]==hav[n]) return 1;
	return 0;
}
int main(){
	scanf("%d%s",&n,s+1);
	for(int i=1;i<=n;i++) if(s[i]=='P') posd[++cntd]=i;
	for(int i=1;i<=n;i++) if(s[i]=='*') posb[++cntb]=i;
	posb[cntb+1]=n+1;
	for(int i=0;i<=cntb;i++){
		for(int j=posb[i];j<posb[i+1];j++) hav[j]=i;
	}
	if(cntd==1){
		int cntl=0,cntr=0,mxl=0,mxr=0;
		for(int i=1;i<=posd[1];i++) if(s[i]=='*') cntl++,mxl=max(mxl,posd[1]-i);
		for(int i=posd[1];i<=n;i++) if(s[i]=='*') cntr++,mxr=max(mxr,i-posd[1]);
		if(cntl>cntr) printf("%d %d\n",cntl,mxl);
		else if(cntr>cntl) printf("%d %d\n",cntr,mxr);
		else printf("%d %d\n",cntl,min(mxl,mxr));
		return 0;
	}
//	check(4);
	int l=1,r=n,ans=-23987;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d %d\n",cntb,ans);
	return 0;
}


#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<stdio.h>
#include<algorithm>
using namespace std;

const int maxn=1000100;

int sum[maxn];
int f[maxn];
int id[maxn];

char s[maxn];
int a[maxn];

int n;
int cnt=0,num=0;

bool Judge(int x)
{
	f[0]=0;
	for (int i=1; i<=num; i++)
	{
		f[i]=0;
		int y=id[i];
		if (f[i-1]>=y-1) f[i]=max(f[i],y+x);
		if (f[i-1]<y-1)
			if (sum[y]-sum[ f[i-1] ])
				if (sum[max(0,y-x-1)]-sum[ f[i-1] ]>0) return false;
				else
				{
					f[i]=max(f[i],y);
					if ( i>=2 && sum[max(0,y-x-1)]-sum[ f[i-2] ]<=0 )
						f[i]=max(f[i],id[i-1]+x);
				}
			else f[i]=max(f[i],y+x);
	}
	if ( f[num]>=n ||  sum[n]-sum[ f[num] ]<=0 ) return true;
	return false;
}

int Binary()
{
	int L=0,R=n;
	while (L+1<R)
	{
		int mid=(L+R)>>1;
		if ( Judge(mid) ) R=mid;
		else L=mid;
	}
	return R;
}

int main()
{

	scanf("%d",&n);
	scanf("%s",s);
	for (int i=1; i<=n; i++)
	{
		if (s[i-1]=='*') a[i]=0,cnt++;
		if (s[i-1]=='P') a[i]=1,id[++num]=i;
		if (s[i-1]=='.') a[i]=2;
	}
	if (num<=1)
		if (num==0) printf("0 0\n");
		else
		{
			int x=0,y=0;
			for (int i=1; i<=n; i++)
				if (a[i]==1) x=i;
			for (int i=1; i<=x; i++)
				if (a[i]==0) y++;

			int Le=0,Ri=0;
			for (int i=x; i>=1; i--)
				if (a[i]==0) Le=x-i;
			for (int i=x; i<=n; i++)
				if (a[i]==0) Ri=i-x;

			if (y>cnt-y) printf("%d %d\n",y,Le);
			else
				if (y<cnt-y) printf("%d %d\n",cnt-y,Ri);
				else
					if (Le<Ri) printf("%d %d\n",y,Le);
					else printf("%d %d\n",cnt-y,Ri);
		}
	else
	{
		sum[0]=0;
		for (int i=1; i<=n; i++)
		{
			sum[i]=sum[i-1];
			if (a[i]==0) sum[i]++;
		}
		int ans=Binary();
		printf("%d %d\n",cnt,ans);
	}

	return 0;
}


#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<stdio.h>
#include<algorithm>
using namespace std;

const int maxn=1000100;

int sum[maxn];
int f[maxn];
int id[maxn];

char s[maxn];
int a[maxn];

int n;
int cnt=0,num=0;

bool Judge(int x)
{
	f[0]=0;
	for (int i=1; i<=num; i++)
	{
		f[i]=0;
		int y=id[i];
		if (f[i-1]>=y-1) f[i]=max(f[i],y+x);
		if (f[i-1]<y-1)
			if (sum[y]-sum[ f[i-1] ])
				if (sum[max(0,y-x-1)]-sum[ f[i-1] ]>0) return false;
				else
				{
					f[i]=max(f[i],y);
					if ( i>=2 && sum[max(0,y-x-1)]-sum[ f[i-2] ]<=0 )
						f[i]=max(f[i],id[i-1]+x);
				}
			else f[i]=max(f[i],y+x);
	}
	if (f[num]>=n) return true;
	return false;
}

int Binary()
{
	int L=0,R=n;
	while (L+1<R)
	{
		int mid=(L+R)>>1;
		if ( Judge(mid) ) R=mid;
		else L=mid;
	}
	return R;
}

int main()
{

	scanf("%d",&n);
	scanf("%s",s);
	for (int i=1; i<=n; i++)
	{
		if (s[i-1]=='*') a[i]=0,cnt++;
		if (s[i-1]=='P') a[i]=1,id[++num]=i;
		if (s[i-1]=='.') a[i]=2;
	}
	if (num<=1)
		if (num==0) printf("0 0\n");
		else
		{
			int x=0,y=0;
			for (int i=1; i<=n; i++)
				if (a[i]==1) x=i;
			for (int i=1; i<=x; i++)
				if (a[i]==0) y++;

			int Le=0,Ri=0;
			for (int i=x; i>=1; i--)
				if (a[i]==0) Le=x-i;
			for (int i=x; i<=n; i++)
				if (a[i]==0) Ri=i-x;

			if (y>cnt-y) printf("%d %d\n",y,Le);
			else
				if (y<cnt-y) printf("%d %d\n",cnt-y,Ri);
				else
					if (Le<Ri) printf("%d %d\n",y,Le);
					else printf("%d %d\n",cnt-y,Ri);
		}
	else
	{
		sum[0]=0;
		for (int i=1; i<=n; i++)
		{
			sum[i]=sum[i-1];
			if (a[i]==0) sum[i]++;
		}
		int ans=Binary();
		printf("%d %d\n",cnt,ans);
	}

	return 0;
}


#include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<stdio.h>
#include<algorithm>
using namespace std;

const int maxn=1000100;

int sum[maxn];
int Next[maxn];

char s[maxn];
int a[maxn];

int n;
int cnt=0,num=0;

bool Judge(int x)
{
	int now=1;
	while (now<=n)
	{
		if (a[now]==2) now++;
		else
			if (a[now]==1)
				if (Next[now+1]<=now+x) now=Next[now+1];
				else now=now+x+1;
			else
			{
				int y=Next[now];
				if ( y>n || y>now+x ) return false;
				int z=Next[y+1];
				if ( z>n || z>now+x ) now=y+1;
				else
					if (sum[z]-sum[y])
					{
						int w=Next[z+1];
						if ( w<=n && w<=y+x ) now=w;
						else now=y+x+1;
					}
					else now=z;
			}
	}
}

int Binary()
{
	int L=0,R=n;
	while (L+1<R)
	{
		int mid=(L+R)>>1;
		if ( Judge(mid) ) R=mid;
		else L=mid;
	}
	return R;
}

int main()
{

	scanf("%d",&n);
	scanf("%s",s);
	for (int i=1; i<=n; i++)
	{
		if (s[i-1]=='*') a[i]=0,cnt++;
		if (s[i-1]=='P') a[i]=1,num++;
		if (s[i-1]=='.') a[i]=2;
	}
	if (num<=1)
		if (num==0) printf("0 0\n");
		else
		{
			int x=0,y=0;
			for (int i=1; i<=n; i++)
				if (a[i]==1) x=i;
			for (int i=1; i<=x; i++)
				if (a[i]==0) y++;

			int Le=0,Ri=0;
			for (int i=x; i>=1; i--)
				if (a[i]==0) Le=x-i;
			for (int i=x; i<=n; i++)
				if (a[i]==0) Ri=i-x;

			if (y>cnt-y) printf("%d %d\n",y,Le);
			else
				if (y<cnt-y) printf("%d %d\n",cnt-y,Ri);
				else
					if (Le<Ri) printf("%d %d\n",y,Le);
					else printf("%d %d\n",cnt-y,Ri);
		}
	else
	{
		Next[n+1]=n+1;
		for (int i=n; i>=1; i--)
		{
			Next[i]=Next[i+1];
			if (a[i]==1) Next[i]=i;
		}
		sum[0]=0;
		for (int i=1; i<=n; i++)
		{
			sum[i]=sum[i-1];
			if (a[i]==0) sum[i]++;
		}
		int ans=Binary();
		printf("%d %d\n",cnt,ans);
	}

	return 0;
}


/*
 * DATE : 2017-10-25
 * Algo :
*/
#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-14
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl
#define nl                      cout<<endl
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 2e6+5;
char s[N];
int f[N];
int a[N];
int cnt = 0;
int sum[N];
int n;
bool checkNoPac(int l, int r)
{
      if(l > r) return 1;
      return (sum[r] - sum[l-1] == 0);
}
bool can(int d)
{
      f[0] = 0;
      for(int i = 1; i <= cnt; i ++) {
            if(checkNoPac(f[i-1] + 1, a[i] - d - 1) == 0) return 0;
            else if(checkNoPac(f[i-1] + 1, a[i] - 1)) f[i] = a[i] + d;
            else if(i>1 && checkNoPac(f[i-2] +1, a[i]- d- 1)) f[i] = max(a[i] , a[i-1] + d);
            else f[i] = a[i];
      }
      if(checkNoPac(f[cnt],n)) return 1;
      return 0;
}
int main(int argc, char const *argv[])
{

      cin >> n;
      cin >> s + 1;

      for(int i = 1; i <= n; ++ i ) {
            sum[i] = sum[i-1] + (s[i] == '*');
            if(s[i] == 'P') a[++cnt] = i;
      }

      if(cnt == 1) {
            int n1 = 0, t1 = 0;
            for(int i = a[1] ; i <= n; i ++) {
                  if(s[i] == '*'){
                        n1++;
                        t1 = i - a[1];
                  }
            }
            int n2 = 0, t2 = 0;
            for(int i = a[1] ; i >= 1; i -- ) {
                  if(s[i] == '*') {
                        n2 ++ ;
                        t2 = a[1] - i;
                  }
            }
            if(n1 > n2) printf("%d %d\n", n1, t1);
            if(n1 < n2) printf("%d %d\n", n2, t2);
            if(n1 == n2) printf("%d %d\n", n1, min(t1,t2));
      }
      else {
            int low = 0, high = n , mid, ans = n;
            while( low <= high) {
                  mid = (low + high)/2;
                  if(can(mid)) ans = mid, high = mid-1;
                  else low = mid+1;
            }
            printf("%d %d\n", sum[n] , ans );
      }

      return 0;
}


/*
 * DATE : 2017-10-25
 * Algo :
*/
#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-14
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl
#define nl                      cout<<endl
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 2e6+5;
char s[N];
int f[N];
int a[N];
int cnt = 0;
int sum[N];
int n;
bool checkNoPac(int l, int r)
{
      if(l > r) return 1;
      return (sum[r] - sum[l-1] == 0);
}
bool can(int d)
{
      f[0] = 0;
      for(int i = 1; i <= cnt; i ++) {
            if(checkNoPac(f[i-1] + 1, a[i] - d - 1) == 0) return 0;
            else if(checkNoPac(f[i-1] + 1, a[i] - 1)) f[i] = a[i] + d;
            else if(i>1 && checkNoPac(f[i-2]+1, a[i]- d- 1)) f[i] = max(f[i],max(a[i] , a[i-1] + d));
            else f[i] = a[i];
      }
      if(checkNoPac(f[cnt]+1,n)) return 1;
      return 0;
}
int main(int argc, char const *argv[])
{

      //READ;
      cin >> n;
      cin >> s + 1;

      for(int i = 1; i <= n; ++ i ) {
            sum[i] = sum[i-1] + (s[i] == '*');
            if(s[i] == 'P') a[++cnt] = i;
      }

      if(cnt == 1) {
            int n1 = 0, t1 = 0;
            for(int i = a[1] ; i <= n; i ++) {
                  if(s[i] == '*'){
                        n1++;
                        t1 = i - a[1];
                  }
            }
            int n2 = 0, t2 = 0;
            for(int i = a[1] ; i >= 1; i -- ) {
                  if(s[i] == '*') {
                        n2 ++ ;
                        t2 = a[1] - i;
                  }
            }
            if(n1 > n2) printf("%d %d\n", n1, t1);
            if(n1 < n2) printf("%d %d\n", n2, t2);
            if(n1 == n2) printf("%d %d\n", n1, min(t1,t2));
            return 0;
      }
      else {
            int low = 0, high = n , mid, ans = n;
            while( low <= high) {
                  mid = (low + high)/2;
                  if(can(mid)) ans = mid, high = mid-1;
                  else low = mid+1;
            }
            printf("%d %d\n", sum[n] , ans );
      }

      return 0;
}


/*
 * DATE : 2017-10-25
 * Algo :
*/
#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-14
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl
#define nl                      cout<<endl
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 2e6+5;
char s[N];
int f[N];
int a[N];
int cnt = 0;
int sum[N];
int n;
bool checkNoPac(int l, int r)
{
      if(l > r) return 1;
      return (sum[r] - sum[l-1] == 0);
}
bool can(int d)
{
      f[0] = 0;
      for(int i = 1; i <= cnt; i ++) {
            if(checkNoPac(f[i-1] + 1, a[i] - d - 1) == 0) return 0;
            else if(checkNoPac(f[i-1] + 1, a[i] - 1)) f[i] = a[i] + d;
            else if(i>1 && checkNoPac(f[i-2]+1, a[i]- d- 1)) f[i] = max(f[i],max(a[i] , a[i-1] + d));
            else f[i] = a[i];
            db(f[i]);
      }
      if(checkNoPac(f[cnt]+1,n)) return 1;
      return 0;
}
int main(int argc, char const *argv[])
{

      //READ;
      cin >> n;
      cin >> s + 1;

      for(int i = 1; i <= n; ++ i ) {
            sum[i] = sum[i-1] + (s[i] == '*');
            if(s[i] == 'P') a[++cnt] = i;
      }

      if(cnt == 1) {
            int n1 = 0, t1 = 0;
            for(int i = a[1] ; i <= n; i ++) {
                  if(s[i] == '*'){
                        n1++;
                        t1 = i - a[1];
                  }
            }
            int n2 = 0, t2 = 0;
            for(int i = a[1] ; i >= 1; i -- ) {
                  if(s[i] == '*') {
                        n2 ++ ;
                        t2 = a[1] - i;
                  }
            }
            if(n1 > n2) printf("%d %d\n", n1, t1);
            if(n1 < n2) printf("%d %d\n", n2, t2);
            if(n1 == n2) printf("%d %d\n", n1, min(t1,t2));
            return 0;
      }
      else {
            int low = 0, high = n , mid, ans = n;
            while( low <= high) {
                  mid = (low + high)/2;
                  if(can(mid)) ans = mid, high = mid-1;
                  else low = mid+1;
            }
            printf("%d %d\n", sum[n] , ans );
      }

      return 0;
}


/*
 * DATE : 2017-10-25
 * Algo :
*/
#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-14
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl
#define nl                      cout<<endl
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 2e6+5;
char s[N];
int f[N];
int a[N];
int cnt = 0;
int sum[N];
int n;
bool checkNoPac(int l, int r)
{
      if(l > r) return 1;
      return (sum[r] - sum[l-1] == 0);
}
bool can(int d)
{
      f[0] = 0;
      for(int i = 1; i <= cnt; i ++) {
            if(checkNoPac(f[i-1] + 1, a[i] - d - 1) == 0) return 0;
            else if(checkNoPac(f[i-1] + 1, a[i] - 1)) f[i] = a[i] + d;
            else if(i>1 && checkNoPac(f[i-2]+1, a[i]- d- 1)) f[i] = max(a[i] , a[i-1] + d);
            else f[i] = a[i];
      }
      if(checkNoPac(f[cnt]+1,n)) return 1;
      return 0;
}
int main(int argc, char const *argv[])
{

      //READ;
      cin >> n;
      cin >> s + 1;

      for(int i = 1; i <= n; ++ i ) {
            sum[i] = sum[i-1] + (s[i] == '*');
            if(s[i] == 'P') a[++cnt] = i;
      }

      if(cnt == 1) {
            int n1 = 0, t1 = 0;
            for(int i = a[1] ; i <= n; i ++) {
                  if(s[i] == '*'){
                        n1++;
                        t1 = i - a[1];
                  }
            }
            int n2 = 0, t2 = 0;
            for(int i = a[1] ; i >= 1; i -- ) {
                  if(s[i] == '*') {
                        n2 ++ ;
                        t2 = a[1] - i;
                  }
            }
            if(n1 > n2) printf("%d %d\n", n1, t1);
            if(n1 < n2) printf("%d %d\n", n2, t2);
            if(n1 == n2) printf("%d %d\n", n1, min(t1,t2));
            return 0;
      }
      else {
            int low = 0, high = n , mid, ans = n;
            while( low <= high) {
                  mid = (low + high)/2;
                  if(can(mid)) ans = mid, high = mid-1;
                  else low = mid+1;
            }
            printf("%d %d\n", sum[n] , ans );
      }

      return 0;
}


#include "bits/stdc++.h"
using namespace std;
const int N = 1e6 + 6;
int n;
char str[N];
void solve1(){
	int idx;
	for(int i = 1 ; i <= n ; ++i){
		if(str[i] == 'P'){
			idx = i;
		}
	}
	int cntl = 0;
	int timl = 0;
	int cntr = 0;
	int timr = 0;
	for(int i = idx ; i >= 1 ; --i){
		if(str[i] == '*'){
			++cntl;
			timl = idx - i;
		}
	}
	for(int i = idx ; i <= n ; ++i){
		if(str[i] == '*'){
			++cntr;
			timr = i - idx;
		}
	}
	if(cntl > cntr){
		printf("%d %d\n" , cntl , timl);
		return;
	}
	if(cntr > cntl){
		printf("%d %d\n" , cntr , timr);
		return;
	}
	printf("%d %d\n" , cntl , min(timl , timr));
}
int sum1[N];
int sum2[N];
int prv[N];
int nxt[N];
int how[N];
bool ok[N];
bool check(int mid){
	int cur = 0;
	for(int i = n ; i >= 1 ; --i){
		if(str[i] == 'P'){
			if(prv[min(n , i + mid)] == i){
				how[i] = min(n , i + mid);
			}
			else{
				how[i] = how[min(n , i + mid)];
			}
		}
		else{
			how[i] = 0;
		}
	}
	ok[n + 1] = 1;
	for(int i = n ; i >= 1 ; --i){
		if(str[i] == '.'){
			ok[i] = ok[i + 1];
			continue;
		}
		if(str[i] == 'P'){
			ok[i] = ok[how[i] + 1];
			continue;
		}
		int cnt = sum2[min(n , i + mid)] - sum2[i];
		if(cnt == 0){
			ok[i] = 0;
			continue;
		}
		if(cnt == 1){
			int idx = prv[min(n , i + mid)];
			ok[i] = ok[idx + 1];
			continue;
		}
		if(cnt >= 3){
			int idx = prv[min(n , i + mid)];
			ok[i] = ok[how[idx] + 1];
			continue;
		}
		int right = prv[min(n , i + mid)];
		int left = prv[right - 1];
		if(ok[left + 1]){
			ok[i] = 1;
			continue;
		}
		int idx = prv[min(n , left + mid)];
		if(idx == right){
			ok[i] = ok[min(n , left + mid) + 1];
			continue;
		}
		ok[i] = ok[how[idx] + 1];
	}
	return ok[1];
}
int main(){
	scanf("%d" , &n);
	scanf("%s" , str + 1);
	int cnt = 0;
	for(int i = 1 ; i <= n ; ++i){
		cnt += str[i] == 'P';
	}
	if(cnt == 1){
		solve1();
		return 0;
	}
	for(int i = 1 ; i <= n ; ++i){
		sum1[i] = sum1[i - 1] + (str[i] == '*');
		sum2[i] = sum2[i - 1] + (str[i] == 'P');
		prv[i] = prv[i - 1];
		if(str[i] == 'P'){
			prv[i] = i;
		}
	}
	for(int i = n ; i >= 1 ; --i){
		if(str[i] == '*'){
			nxt[i] = i;
		}
		else{
			nxt[i] = nxt[i + 1];
		}
	}
	int l = 1;
	int r = n;
	while(l < r){
		int mid = l + r >> 1;
		if(check(mid)){
			r = mid;
		}
		else{
			l = mid + 1;
		}
	}
	printf("%d %d\n" , sum1[n] , l);
}


#include "bits/stdc++.h"
using namespace std;
const int N = 1e6 + 6;
int n;
char str[N];
void solve1(){
	int idx;
	for(int i = 1 ; i <= n ; ++i){
		if(str[i] == 'P'){
			idx = i;
		}
	}
	int cntl = 0;
	int timl = 0;
	int cntr = 0;
	int timr = 0;
	for(int i = idx ; i >= 1 ; --i){
		if(str[i] == '*'){
			++cntl;
			timl = idx - i;
		}
	}
	for(int i = idx ; i <= n ; ++i){
		if(str[i] == '*'){
			++cntr;
			timr = i - idx;
		}
	}
	if(cntl > cntr){
		printf("%d %d\n" , cntl , timl);
		return;
	}
	if(cntr > cntl){
		printf("%d %d\n" , cntr , timr);
		return;
	}
	printf("%d %d\n" , cntl , min(timl , timr));
}
int sum1[N];
int sum2[N];
int prv[N];
bool check(int mid){
	int cur = 0;
	for(int i = 1 ; i <= n ; ++i){
		if(str[i] == '.'){
			continue;
		}
		if(str[i] == 'P'){
			cur = max(cur , i + mid);
			continue;
		}
		if(i <= cur){
			continue;
		}
		int cnt = sum2[min(n , i + mid)] - sum2[i];
		if(cnt == 0){
			return 0;
		}
		if(cnt == 1){
			int idx = prv[min(n , i + mid)];
			cur = idx;
			i = idx;
			continue;
		}
		if(cnt >= 3){
			int right = prv[min(n , i + mid)];
			cur = right + mid;
			i = right;
			continue;
		}
		int right = prv[min(n , i + mid)];
		int left = prv[right - 1];
		if(sum1[right] - sum1[left]){
			cur = left + mid;
			i = right;
			continue;
		}
		cur = right + mid;
		i = right;
		continue;
	}
	return 1;
}
int main(){
	scanf("%d" , &n);
	scanf("%s" , str + 1);
	int cnt = 0;
	for(int i = 1 ; i <= n ; ++i){
		cnt += str[i] == 'P';
	}
	if(cnt == 1){
		solve1();
		return 0;
	}
	for(int i = 1 ; i <= n ; ++i){
		sum1[i] = sum1[i - 1] + (str[i] == '*');
		sum2[i] = sum2[i - 1] + (str[i] == 'P');
		prv[i] = prv[i - 1];
		if(str[i] == 'P'){
			prv[i] = i;
		}
	}
	int l = 1;
	int r = n;
	while(l < r){
		int mid = l + r >> 1;
		if(check(mid)){
			r = mid;
		}
		else{
			l = mid + 1;
		}
	}
	printf("%d %d\n" , sum1[n] , l);
}


#include "bits/stdc++.h"
using namespace std;
const int N = 1e6 + 6;
int n;
char str[N];
void solve1(){
	int idx;
	for(int i = 1 ; i <= n ; ++i){
		if(str[i] == 'P'){
			idx = i;
		}
	}
	int cntl = 0;
	int timl = 0;
	int cntr = 0;
	int timr = 0;
	for(int i = idx ; i >= 1 ; --i){
		if(str[i] == '*'){
			++cntl;
			timl = idx - i;
		}
	}
	for(int i = idx ; i <= n ; ++i){
		if(str[i] == '*'){
			++cntr;
			timr = i - idx;
		}
	}
	if(cntl > cntr){
		printf("%d %d\n" , cntl , timl);
		return;
	}
	if(cntr > cntl){
		printf("%d %d\n" , cntr , timr);
		return;
	}
	printf("%d %d\n" , cntl , min(timl , timr));
}
int sum1[N];
int sum2[N];
int prv[N];
int how[N];
bool ok[N];
bool check(int mid){
	for(int i = n ; i >= 1 ; --i){
		if(str[i] == 'P'){
			if(prv[min(n , i + mid)] == i){
				how[i] = min(n , i + mid);
			}
			else{
				how[i] = how[prv[min(n , i + mid)]];
			}
		}
		else{
			how[i] = 0;
		}
	}
	ok[n + 1] = 1;
	for(int i = n ; i >= 1 ; --i){
		if(str[i] == '.'){
			ok[i] = ok[i + 1];
			continue;
		}
		if(str[i] == 'P'){
			ok[i] = ok[how[i] + 1];
			continue;
		}
		int cnt = sum2[min(n , i + mid)] - sum2[i];
		if(cnt == 0){
			ok[i] = 0;
			continue;
		}
		if(cnt == 1){
			int idx = prv[min(n , i + mid)];
			ok[i] = ok[idx + 1];
			continue;
		}
		if(cnt >= 3){
			int idx = prv[min(n , i + mid)];
			ok[i] = ok[how[idx] + 1];
			continue;
		}
		int right = prv[min(n , i + mid)];
		int left = prv[right - 1];
		if(ok[left + 1]){
			ok[i] = 1;
			continue;
		}
		int idx = prv[min(n , left + mid)];
		if(idx == right){
			ok[i] = ok[min(n , left + mid) + 1];
			continue;
		}
		ok[i] = ok[how[idx] + 1];
	}
	return ok[1];
}
int main(){
	scanf("%d" , &n);
	scanf("%s" , str + 1);
	int cnt = 0;
	for(int i = 1 ; i <= n ; ++i){
		cnt += str[i] == 'P';
	}
	if(cnt == 1){
		solve1();
		return 0;
	}
	for(int i = 1 ; i <= n ; ++i){
		sum1[i] = sum1[i - 1] + (str[i] == '*');
		sum2[i] = sum2[i - 1] + (str[i] == 'P');
		prv[i] = prv[i - 1];
		if(str[i] == 'P'){
			prv[i] = i;
		}
	}
	int l = 1;
	int r = n;
	while(l < r){
		int mid = l + r >> 1;
		if(check(mid)){
			r = mid;
		}
		else{
			l = mid + 1;
		}
	}
	printf("%d %d\n" , sum1[n] , l);
}


#include <cstdio>
#include <algorithm>
#define N 1000005
int n, a[N], tag[N], cnt, cnt1;
char s[N];
bool check(int d)
{
	std::fill(tag+1, tag+n+1, 0);
	int l, r=0, r1=0, i;
	for(int i=n; i; --i) if(i-1<=d&&a[i]==2) { r=i; break; }
	for(l=1, i=1; i<=n; ++i, ((i+d<=n&&a[i+d]==2)?r=i+d:0))
	{
		while(i<=n&&a[i]!=1) ++i, (i+d<=n&&a[i+d]==2)?r=i+d:0;
		if(i>n) return 1;
		l=std::max(l, i-d);
		while(l<=n&&l<=i+d&&(a[l]!=2||tag[l])) ++l;
		if(!tag[r1]||r1<i) r1=r;
		if(l<i) continue;
		if(r1>i) tag[r1]=1;
		else return 0;
	}
	return 1;
}
int main()
{
	freopen("A.in", "r", stdin);
	scanf("%d%s", &n, s+1);
	for(int i=1; i<=n; ++i) a[i]=(s[i]=='*'?1:s[i]=='P'?2:0), cnt+=a[i]==2, cnt1+=a[i]==1;
	if(cnt==0||cnt1==0) return puts("0 0"), 0;
	if(cnt==1)
	{
		int cl=0, ml=0x3f3f3f3f, cr=0, mr=0, id;
		for(int i=1; a[i]!=2; ++i) if(a[i]==1) ++cl, ml=std::min(ml, i);
		for(int i=n; a[i]!=2; --i) if(a[i]==1) ++cr, mr=std::max(ml, i);
		for(id=1; a[id]!=2; ++id);
		printf("%d %d\n", std::max(cl, cr), (cl==cr?std::min(id-ml, mr-id):cl>cr?id-ml:mr-id));
		return 0;
	}
	int l=0, r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d %d\n", cnt1, l);
	return 0;
}


#include <cstdio>
#include <algorithm>
#define N 1000005
int n, a[N], tag[N], cnt, cnt1;
char s[N];
bool check(int d)
{
	std::fill(tag+1, tag+n+1, 0);
	int l, r=0, r1=0, i;
	for(int i=n; i; --i) if(i-1<=d&&a[i]==2) { r=i; break; }
	for(l=1, i=1; i<=n; ++i, ((i+d<=n&&a[i+d]==2)?r=i+d:0))
	{
		while(i<=n&&a[i]!=1) ++i, (i+d<=n&&a[i+d]==2)?r=i+d:0;
		if(i>n) return 1;
		l=std::max(l, i-d);
		while(l<=n&&l<=i+d&&(a[l]!=2||tag[l])) ++l;
		if(!tag[r1]||r1<i) r1=r;
		if(l<i) continue;
		if(r1>i) tag[r1]=1;
		else return 0;
	}
	return 1;
}
int main()
{
	scanf("%d%s", &n, s+1);
	for(int i=1; i<=n; ++i) a[i]=(s[i]=='*'?1:s[i]=='P'?2:0), cnt+=a[i]==2, cnt1+=a[i]==1;
	if(cnt==0||cnt1==0) return puts("0 0"), 0;
	if(cnt==1)
	{
		int cl=0, ml=0x3f3f3f3f, cr=0, mr=0, id;
		for(int i=1; a[i]!=2; ++i) if(a[i]==1) ++cl, ml=std::min(ml, i);
		for(int i=n; a[i]!=2; --i) if(a[i]==1) ++cr, mr=std::max(ml, i);
		for(id=1; a[id]!=2; ++id);
		printf("%d %d\n", std::max(cl, cr), (cl==cr?std::min(id-ml, mr-id):cl>cr?id-ml:mr-id));
		return 0;
	}
	int l=0, r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d %d\n", cnt1, l);
	return 0;
}


#include <cstdio>
#include <algorithm>
#define N 1000005
int n, a[N], tag[N], cnt, cnt1;
char s[N];
bool check(int d)
{
	std::fill(tag+1, tag+n+1, 0);
	int l, r=0, r1=0, i;
	for(int i=n; i; --i) if(i-1<=d&&a[i]==2) { r=i; break; }
	for(l=1, i=1; i<=n; ++i, ((i+d<=n&&a[i+d]==2)?r=i+d:0))
	{
		while(i<=n&&a[i]!=1) ++i, (i+d<=n&&a[i+d]==2)?r=i+d:0;
		if(i>n) return 1;
		l=std::max(l, i-d);
		while(l<=n&&l<=i+d&&(a[l]!=2||tag[l])) ++l;
		if(!tag[r1]||r1<i) r1=r;
		if(l<i) continue;
		if(r1>i) tag[r1]=1;
		else return 0;
	}
	return 1;
}
int main()
{
	scanf("%d%s", &n, s+1);
	for(int i=1; i<=n; ++i) a[i]=(s[i]=='*'?1:s[i]=='P'?2:0), cnt+=a[i]==2, cnt1+=a[i]==1;
	if(cnt==0||cnt1==0) return puts("0 0"), 0;
	if(cnt==1)
	{
		int cl=0, ml=0x3f3f3f3f, cr=0, mr=0, id;
		for(int i=1; a[i]!=2; ++i) if(a[i]==1) ++cl, ml=std::min(ml, i);
		for(int i=n; a[i]!=2; --i) if(a[i]==1) ++cr, mr=std::max(mr, i);
		for(id=1; a[id]!=2; ++id);
		printf("%d %d\n", std::max(cl, cr), (cl==cr?std::min(id-ml, mr-id):cl>cr?id-ml:mr-id));
		return 0;
	}
	int l=0, r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d %d\n", cnt1, l);
	return 0;
}


#include <cstdio>
#include <algorithm>
#define N 1000005
int n, a[N], f[N], pos[N], sum[N], cnt, cnt1;
char s[N];
inline int ask(int l, int r) { return (l>r)?0:sum[r]-sum[l-1]; }
bool check(int d)
{
	for(int i=1; i<=pos[0]; ++i)
	{
		f[i]=0;
		if(ask(f[i-1]+1, pos[i]-d-1)==0) f[i]=std::max(f[i], std::max(f[i-1], pos[i]));
		if(ask(f[i-1]+1, pos[i]-1)==0) f[i]=std::max(f[i], std::max(f[i-1], pos[i]+d));
		if(i>1&&pos[i-1]>=pos[i]-d&&ask(f[i-2]+1, pos[i]-d-1)==0)
		f[i]=std::max(f[i], pos[i-1]+d);
	}
	return f[pos[0]]>n||(sum[f[pos[0]]]==sum[n]);
}
int main()
{
	scanf("%d%s", &n, s+1);
	for(int i=1; i<=n; ++i) a[i]=(s[i]=='*'?1:s[i]=='P'?2:0), cnt+=a[i]==2, cnt1+=a[i]==1;
	if(cnt==0||cnt1==0) return puts("0 0"), 0;
	if(cnt==1)
	{
		int cl=0, ml=0x3f3f3f3f, cr=0, mr=0, id;
		for(int i=1; a[i]!=2; ++i) if(a[i]==1) ++cl, ml=std::min(ml, i);
		for(int i=n; a[i]!=2; --i) if(a[i]==1) ++cr, mr=std::max(mr, i);
		for(id=1; a[id]!=2; ++id);
		printf("%d %d\n", std::max(cl, cr), (cl==cr?std::min(id-ml, mr-id):cl>cr?id-ml:mr-id));
		return 0;
	}
	for(int i=1; i<=n; ++i) sum[i]=sum[i-1]+(a[i]==1), (a[i]==2?pos[++pos[0]]=i:0);
	int l=0, r=n;
	while(l<r)
	{
		int mid=(l+r)>>1;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d %d\n", cnt1, l);
	return 0;
}


// Mivik 2020.9.27
#ifndef MIVIK
#	define NDEBUG
#endif

#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstring>
#include <iostream>

#define d isdigit(c)
#define g c=t.get();
#define L return
#define K break
#define A(c,a,b)if(c)a else b;
#define I(c,a)if(c)a;
#define Y goto E
struct MI{private:char bb[4096];FILE*f;char*bs,*be;char e;bool o,l;public:MI():f(stdin){}
#ifdef __linux__
#endif
inline char get(){if(o){o=0;L e;}
#ifdef MIVIK
char c=fgetc(f);I(c==-1,l=1)L c;
#else
I(bs==be,be=(bs=bb)+fread(bb,1,sizeof(bb),f))I(bs==be,{l=1;L-1;})L*bs++;
#endif
}inline void unget(char c){o=1;e=c;}template<typename T>inline T read(){T r;*this>r;L r;}template<typename T>inline MI&operator>(T&);};template<typename T>struct Q{const static bool U=T(-1)>=T(0);inline void operator()(MI&t,T&r)const{r=0;char c;bool y=0;A(U,for(;;){g I(c==-1,Y)I(d,K)},for(;;){g I(c==-1,Y)A(c=='-',{g I(d,{y=1;K;})},I(d,K))})for(;;){I(c==-1,Y)A(d,r=r*10+(c^48);,K)g}t.unget(c);E:;I(y,r=-r)}};template<>struct Q<char>{inline void operator()(MI&t,char&r){int c;for(;;){g I(c==-1,{r=-1;L;})I(!isspace(c),{r=c;L;})}}};template<typename T>inline MI&MI::operator>(T&t){Q<T>()(*this,t);L*this;}
#undef d
#undef g
#undef L
#undef K
#undef A
#undef I
#undef Y
template<typename T>std::ostream& operator<(std::ostream&out,const T&t){return out<<t;}
#define endl ('\n')
#define P(x) cout < #x" = " < (x) < endl
#define R (cin.read<int>())

using std::cout;

MI cin;

typedef long long qe;

const int nmax = 1000001;

template<typename T> inline bool getmax(T &a, const T &b) { return a < b && (a = b, true); }

int n;
char s[nmax];
int pos[nmax], bp[nmax];
int f[nmax];
int mi, mx, cnt, tot;
inline int find(int x) {
	if (x >= n) return cnt;
	if (x < 1) return 0;
	if (bp[x] != bp[x + 1]) return bp[x];
	return bp[x] - 1;
}
inline bool check(int x) {
	for (int i = 1; i <= tot; ++i) {
		f[i] = INT_MIN;
		if (f[i - 1] >= bp[pos[i]] - 1) f[i] = std::max(f[i - 1], find(pos[i] + x));
		const int lo = (pos[i] - x < 1) ? 1 : bp[pos[i] - x];
		if (lo > f[i - 1] + 1) return false;
		getmax(f[i], bp[pos[i]] - 1);
		if (i > 1 && lo <= f[i - 2] + 1) getmax(f[i], find(pos[i - 1] + x));
		assert(f[i] >= f[i - 1]);
	}
	return f[tot] == cnt;
}
int main() {
	cin > n;
	char c = cin.read<char>();
	for (int i = 1; i <= n; ++i) {
		s[i] = c;
		if (c == '*') {
			bp[i] = ++cnt;
			if (!mi) mi = i;
			mx = i;
		} else if (c == 'P')
			pos[++tot] = i;
		c = cin.get();
	}
	bp[n + 1] = cnt + 1;
	for (int i = n; i; --i)
		if (!bp[i]) bp[i] = bp[i + 1];
	if (tot == 1) {
		const int a1 = bp[pos[1]] - 1, a2 = cnt - bp[pos[1]] + 1;
		const int c1 = pos[1] - mi, c2 = mx - pos[1];
		if (a1 > a2 || (a1 == a2 && c1 < c2))
			cout < a1 < ' ' < c1 < endl;
		else
			cout < a2 < ' ' < c2 < endl;
		return 0;
	}
	int l = 0, r = n, ret = 0;
	while (l <= r) {
		const int mid = (l + r) >> 1;
		if (check(mid)) {
			ret = mid;
			r = mid - 1;
		} else
			l = mid + 1;
	}
	cout < cnt < ' ' < ret < endl;
	return 0;
}


// Mivik 2020.9.27
#ifndef MIVIK
#	define NDEBUG
#endif

#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstring>
#include <iostream>

#define d isdigit(c)
#define g c=t.get();
#define L return
#define K break
#define A(c,a,b)if(c)a else b;
#define I(c,a)if(c)a;
#define Y goto E
struct MI{private:char bb[4096];FILE*f;char*bs,*be;char e;bool o,l;public:MI():f(stdin){}
#ifdef __linux__
#endif
inline char get(){if(o){o=0;L e;}
#ifdef MIVIK
char c=fgetc(f);I(c==-1,l=1)L c;
#else
I(bs==be,be=(bs=bb)+fread(bb,1,sizeof(bb),f))I(bs==be,{l=1;L-1;})L*bs++;
#endif
}inline void unget(char c){o=1;e=c;}template<typename T>inline T read(){T r;*this>r;L r;}template<typename T>inline MI&operator>(T&);};template<typename T>struct Q{const static bool U=T(-1)>=T(0);inline void operator()(MI&t,T&r)const{r=0;char c;bool y=0;A(U,for(;;){g I(c==-1,Y)I(d,K)},for(;;){g I(c==-1,Y)A(c=='-',{g I(d,{y=1;K;})},I(d,K))})for(;;){I(c==-1,Y)A(d,r=r*10+(c^48);,K)g}t.unget(c);E:;I(y,r=-r)}};template<>struct Q<char>{inline void operator()(MI&t,char&r){int c;for(;;){g I(c==-1,{r=-1;L;})I(!isspace(c),{r=c;L;})}}};template<typename T>inline MI&MI::operator>(T&t){Q<T>()(*this,t);L*this;}
#undef d
#undef g
#undef L
#undef K
#undef A
#undef I
#undef Y
template<typename T>std::ostream& operator<(std::ostream&out,const T&t){return out<<t;}
#define endl ('\n')
#define P(x) cout < #x" = " < (x) < endl
#define R (cin.read<int>())

using std::cout;

MI cin;

typedef long long qe;

const int nmax = 1000001;

template<typename T> inline bool getmax(T &a, const T &b) { return a < b && (a = b, true); }

int n;
char s[nmax];
int pos[nmax], bp[nmax];
int f[nmax];
int mi, mx, cnt, tot;
inline int find(int x) {
	if (x > n) return cnt;
	if (x < 1) return 1;
	return bp[x];
}
inline bool check(int x) {
	for (int i = 1; i <= tot; ++i) {
		if (f[i - 1] >= bp[pos[i]] - 1) f[i] = std::max(f[i - 1], find(pos[i] + x));
		const int lo = find(pos[i] - x);
		if (lo > f[i - 1] + 1) return false;
		f[i] = bp[pos[i]] - 1;
		if (i > 1 && lo <= f[i - 2] + 1) getmax(f[i], find(pos[i - 1] + x));
		assert(f[i] >= f[i - 1]);
	}
	return f[tot] == cnt;
}
int main() {
	cin > n;
	char c = cin.read<char>();
	for (int i = 1; i <= n; ++i) {
		s[i] = c;
		if (c == 'B') {
			bp[i] = ++cnt;
			if (!mi) mi = i;
			mx = i;
		} else if (c == 'D')
			pos[++tot] = i;
		c = cin.get();
	}
	bp[n + 1] = cnt + 1;
	for (int i = n; i; --i)
		if (!bp[i]) bp[i] = bp[i + 1];
	if (tot == 1) {
		const int a1 = bp[pos[1]] - 1, a2 = cnt - bp[pos[1]] + 1;
		const int c1 = pos[1] - mi, c2 = mx - pos[1];
		if (a1 > a2 || (a1 == a2 && c1 < c2))
			cout < a1 < ' ' < c1 < endl;
		else
			cout < a2 < ' ' < c2 < endl;
		return 0;
	}
	int l = 0, r = n, ret = 0;
	while (l <= r) {
		const int mid = (l + r) >> 1;
		if (check(mid)) {
			ret = mid;
			r = mid - 1;
		} else
			l = mid + 1;
	}
	cout < cnt < ' ' < ret < endl;
	return 0;
}


// Mivik 2020.9.27
#ifndef MIVIK
#	define NDEBUG
#endif

#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstring>
#include <iostream>

#define d isdigit(c)
#define g c=t.get();
#define L return
#define K break
#define A(c,a,b)if(c)a else b;
#define I(c,a)if(c)a;
#define Y goto E
struct MI{private:char bb[4096];FILE*f;char*bs,*be;char e;bool o,l;public:MI():f(stdin){}
#ifdef __linux__
#endif
inline char get(){if(o){o=0;L e;}
#ifdef MIVIK
char c=fgetc(f);I(c==-1,l=1)L c;
#else
I(bs==be,be=(bs=bb)+fread(bb,1,sizeof(bb),f))I(bs==be,{l=1;L-1;})L*bs++;
#endif
}inline void unget(char c){o=1;e=c;}template<typename T>inline T read(){T r;*this>r;L r;}template<typename T>inline MI&operator>(T&);};template<typename T>struct Q{const static bool U=T(-1)>=T(0);inline void operator()(MI&t,T&r)const{r=0;char c;bool y=0;A(U,for(;;){g I(c==-1,Y)I(d,K)},for(;;){g I(c==-1,Y)A(c=='-',{g I(d,{y=1;K;})},I(d,K))})for(;;){I(c==-1,Y)A(d,r=r*10+(c^48);,K)g}t.unget(c);E:;I(y,r=-r)}};template<>struct Q<char>{inline void operator()(MI&t,char&r){int c;for(;;){g I(c==-1,{r=-1;L;})I(!isspace(c),{r=c;L;})}}};template<typename T>inline MI&MI::operator>(T&t){Q<T>()(*this,t);L*this;}
#undef d
#undef g
#undef L
#undef K
#undef A
#undef I
#undef Y
template<typename T>std::ostream& operator<(std::ostream&out,const T&t){return out<<t;}
#define endl ('\n')
#define P(x) cout < #x" = " < (x) < endl
#define R (cin.read<int>())

using std::cout;

MI cin;

typedef long long qe;

const int nmax = 1000001;

template<typename T> inline bool getmax(T &a, const T &b) { return a < b && (a = b, true); }

int n;
char s[nmax];
int pos[nmax], bp[nmax];
int f[nmax];
int mi, mx, cnt, tot;
inline int find(int x) {
	if (x > n) return cnt;
	if (x < 1) return 1;
	return bp[x];
}
inline bool check(int x) {
	for (int i = 1; i <= tot; ++i) {
		if (f[i - 1] >= bp[pos[i]] - 1) f[i] = std::max(f[i - 1], find(pos[i] + x));
		const int lo = find(pos[i] - x);
		if (lo > f[i - 1] + 1) return false;
		f[i] = bp[pos[i]] - 1;
		if (i > 1 && lo <= f[i - 2] + 1) getmax(f[i], find(pos[i - 1] + x));
		assert(f[i] >= f[i - 1]);
	}
	return f[tot] == cnt;
}
int main() {
	cin > n;
	char c = cin.read<char>();
	for (int i = 1; i <= n; ++i) {
		s[i] = c;
		if (c == '*') {
			bp[i] = ++cnt;
			if (!mi) mi = i;
			mx = i;
		} else if (c == 'P')
			pos[++tot] = i;
		c = cin.get();
	}
	bp[n + 1] = cnt + 1;
	for (int i = n; i; --i)
		if (!bp[i]) bp[i] = bp[i + 1];
	if (tot == 1) {
		const int a1 = bp[pos[1]] - 1, a2 = cnt - bp[pos[1]] + 1;
		const int c1 = pos[1] - mi, c2 = mx - pos[1];
		if (a1 > a2 || (a1 == a2 && c1 < c2))
			cout < a1 < ' ' < c1 < endl;
		else
			cout < a2 < ' ' < c2 < endl;
		return 0;
	}
	int l = 0, r = n, ret = 0;
	while (l <= r) {
		const int mid = (l + r) >> 1;
		if (check(mid)) {
			ret = mid;
			r = mid - 1;
		} else
			l = mid + 1;
	}
	cout < cnt < ' ' < ret < endl;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define FOR(i, a, b) for(int i = (a); i <= (b); i ++)
#define FORd(i, a, b) for(int i = (a); i >= (b); i --)
#define FORv(i, a, b) for(int i = (a); i < (b); i ++)
#define II pair<int, int>
#define x first
#define y second
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 1e6 + 69;
int n, f[maxn], p[maxn], sum[maxn], k;
string s;
int get(int l, int r)
{
    if(l > r) return 0;
    return sum[r] - sum[l - 1];
}
bool kt(int t)
{
    for(int i = 1; i <= k; i ++){
        if(get(f[i - 1] + 1, p[i] - t - 1)) return 0;
        if(get(f[i - 1] + 1, p[i] - 1) == 0) f[i] = p[i] + t;
        else if(i > 1 && get(f[i - 2] + 1, p[i] - t - 1) == 0) f[i] = max(p[i - 1] + t, p[i]);
        else f[i] = p[i];
    }
    return get(f[k] + 1, n) == 0;
}
int main()
{
    ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> s;
    s = ' ' + s;
    for(int i = 1; i <= n; i ++){
        if(s[i] == 'P') p[++k] = i;
        sum[i] = sum[i - 1] + (s[i] == '*');
    }
    if(k == 1){
        int cntl = 0, cntr = 0, l = 0, r = 0;
        for(int i = p[k] - 1; i >= 1; i --){
            if(s[i] == '*') cntl ++, l = i;
        }
        for(int i = p[k] + 1; i <= n; i ++){
            if(s[i] == '*') cntr ++, r = i;
        }
        if(cntl > cntr) cout << cntl << ' ' << p[k] - l;
        else if(cntl < cntr) cout << cntr << ' ' << r - p[k];
        else cout << cntl << ' ' << min(p[k] - l, r - p[k]);
    }
    else{
        int l = 1, r = n;
        while(l < r){
            int m = (l + r) / 2;
            if(kt(m)) r = m;
                else l = m + 1;
        }
        cout << sum[n] << ' ' << l;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}

signed main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){
    #else
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    #endif // LOCAL_RUN

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> p;
    for(int i=0;i<n;++i){
        if(s[i] == 'P'){
            p.push_back(i);
        }
    }
    if(p.size() == 1){
        int s1, l1, s2, r2;
        s1=s2=0;
        l1=r2=-1;
        for(int i=p[0]-1;i>=0;--i){
            if(s[i]=='*'){
                ++s1;
                l1=i;
            }
        }
        for(int i=p[0]+1;i<n;++i){
            if(s[i]=='*'){
                ++s2;
                r2=i;
            }
        }
        pair<int, int> t1(-s1, p[0]-l1), t2(-s2, r2-p[0]);
        auto t = min(t1, t2);
        cout << -t.first << " " << t.second<<"\n";
    } else {
        // can eat all;
        int cnt = 0;
        for(int i=0;i<n;++i){
            if(s[i] == '*') ++cnt;
        }
        int l=0, r=n;
        string ss;
        while(l+1<r){
            int m = l+(r-l)/2;
            bool f = false;
            int b = -1;
            ss = s;
            // clear best to left
            int cleft = 0;
            int scnt = 0;
            for(int i=n-1;i>=0;--i){
                --cleft;
                if(ss[i] == 'P'){
                    if(scnt == 0){
                        cleft=m+1;
                        ss[i] = '.';
                    }
                    scnt = 0;
                } else if(ss[i] == '*'){
                    if(cleft>0){
                        ss[i] = '.';
                    } else {
                        ++scnt;
                    }
                }
            }
            //cerr << m << " : " << ss << "\n";
            p.clear();
            for(int i=0;i<n;++i){
                if(ss[i] == 'P'){
                    p.push_back(i);
                }
            }

            for(int i=0;i<n;++i){
                if(ss[i] == '*'){
                    if(b<i){
                        //grab from future
                        auto it = upper_bound(p.begin(), p.end(), i+m);
                        if(it == p.begin()){
                            f=true;
                            break;
                        }
                        --it;
                        if(*it<i){
                            f=true;
                            break;
                        }
                        ss[*it] = '.';
                        b = *it;
                    }
                } else if(ss[i] == 'P'){
                    b = i+m;
                }
            }
            if(!f){
                r=m;
            } else {
                l=m;
            }
        }
        cout << cnt << " " << r << "\n";
    }

    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}

signed main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){
    #else
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    #endif // LOCAL_RUN

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> p;
    for(int i=0;i<n;++i){
        if(s[i] == 'P'){
            p.push_back(i);
        }
    }
    if(p.size() == 1){
        int s1, l1, s2, r2;
        s1=s2=0;
        l1=r2=-1;
        for(int i=p[0]-1;i>=0;--i){
            if(s[i]=='*'){
                ++s1;
                l1=i;
            }
        }
        for(int i=p[0]+1;i<n;++i){
            if(s[i]=='*'){
                ++s2;
                r2=i;
            }
        }
        pair<int, int> t1(-s1, p[0]-l1), t2(-s2, r2-p[0]);
        auto t = min(t1, t2);
        cout << -t.first << " " << t.second<<"\n";
    } else {
        // can eat all;
        int cnt = 0;
        for(int i=0;i<n;++i){
            if(s[i] == '*') ++cnt;
        }
        int l=0, r=n;
        string ss;
        while(l+1<r){
            int m = l+(r-l)/2;
            bool f = false;
            int b = -1;
            ss = s;
            for(int i=0;i<n;++i){
                if(ss[i] == '*'){
                    if(b<i){
                        //grab from future
                        auto it = upper_bound(p.begin(), p.end(), i+m);
                        if(it == p.begin()){
                            f=true;
                            break;
                        }
                        --it;
                        if(*it<i){
                            f=true;
                            break;
                        }
                        ss[*it] = '.';
                        b = *it;
                    }
                } else if(ss[i] == 'P'){
                    b = i+m;
                }
            }
            if(!f){
                r=m;
            } else {
                l=m;
            }
        }
        cout << cnt << " " << r << "\n";
    }

    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}

signed main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){
    #else
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    #endif // LOCAL_RUN

    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> p;
    for(int i=0;i<n;++i){
        if(s[i] == 'P'){
            p.push_back(i);
        }
    }
    if(p.size() == 1){
        int s1, l1, s2, r2;
        s1=s2=0;
        l1=r2=-1;
        for(int i=p[0]-1;i>=0;--i){
            if(s[i]=='*'){
                ++s1;
                l1=i;
            }
        }
        for(int i=p[0]+1;i<n;++i){
            if(s[i]=='*'){
                ++s2;
                r2=i;
            }
        }
        pair<int, int> t1(s1, p[0]-l1), t2(s2, r2-p[0]);
        auto t = min(t1, t2);
        cout << t.first << " " << t.second<<"\n";
    } else {
        // can eat all;
        int cnt = 0;
        for(int i=0;i<n;++i){
            if(s[i] == '*') ++cnt;
        }
        int l=0, r=n;
        string ss;
        while(l+1<r){
            int m = l+(r-l)/2;
            bool f = false;
            int b = -1;
            ss = s;
            for(int i=0;i<n;++i){
                if(ss[i] == '*'){
                    if(b<i){
                        //grab from future
                        auto it = upper_bound(p.begin(), p.end(), i+m);
                        if(it == p.begin()){
                            f=true;
                            break;
                        }
                        --it;
                        if(*it<i){
                            f=true;
                            break;
                        }
                        ss[*it] = '.';
                        b = *it;
                    }
                } else if(ss[i] == 'P'){
                    b = i+m;
                }
            }
            if(!f){
                r=m;
            } else {
                l=m;
            }
        }
        cout << cnt << " " << r << "\n";
    }

    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}