''' Codeforces Round 971 (Div. 4) Problem : https://codeforces.com/contest/2009/problem/B Solution: https://aruljohn.com/blog/osu-mania-problem/ ''' t = int(input()) for _ in range(t): n = int(input()) notes = [] for _ in range(n): notes.append(input()) notes.reverse() ans = [] for note in notes: ans.append(note.find('#') + 1) print(*ans)