#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <array>
#include <string>
#include <cstdio>
#include <iterator>
#include <unordered_set>
#include <cstdint>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
/*
notes:
int64_t
stoi(string s) -> string to int
to_string() -> int (or else) to string
vector declaration:
vector<ll> v(n, 0)
vector<vector<ll>> v(n, vector<ll>(n, 0));
{if statement} ? {truth value} : {false value}
set lower bound/upper bound:
// . . . m1 . . . d . . . . m2
auto m1_it = b.lower_bound(d);
advance(m1_it, -1);
m1 = *m1_it;
m2 = *b.upper_bound(d);
*/
typedef long long ll;
ll section(ll n) {
return (n/2) + 1;
}
void solve() {
ll n = 0;
cin >> n;
string s;
cin >> s;
s = "-" + s + "-";
n+=2;
ll secs = 0;
ll left = -1;
ll right = -1;
vector<ll> v;
for(ll i = 0; i < n; i++) {
if(left == -1 && s[i] == '.') {
left = i;
}
if(s[i] == '-' && left != -1) {
right = i;
//cerr << "\nl=" << left;
//cerr << "\nr=" << right;
v.push_back(section(right - left));
left = -1;
}
}
sort(v.rbegin(), v.rend());
/*
cerr << "\nsections:";
for(ll i = 0; i < v.size(); i++) {
cerr << v[i] << " ";
}
*/
//secs = section(*v.rbegin());
//ll lost = 0;
//ll gained = 0;
for(ll i = 0; i < v.size(); i++) {
v[i] += i;
/*
if(v[i] == v[i+1]) {
lost++;
}
if(v[i] < v[i+1]-1) {
gained += v[i+1]-1 - v[i];
}
*/
}
/*
if(gained < lost) {
secs += lost - gained;
}
*/
sort(v.rbegin(), v.rend());
cout << v.size() << " " << *v.begin() << "\n";
}
int main()
{
std::ios_base::sync_with_stdio(false);
ll tests = 0;
cin >> tests;
while(tests--)
{
solve();
}
return 0;
}