#include <cstdio>
#include <cstring>
#include <cctype>

int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    int t;
    char s[100];
    scanf("%d", &t);
    while (t--) {
        scanf("%s", s);
        int n = strlen(s);
        bool first = true;
        for (int i = 0; i < n; ++i)
            if (isdigit(s[i])) {
                if (first) first = false;
                else putchar(' ');
                printf("%d", i + 1);
            }
        puts("");
    }
    return 0;
}

/**************************************************************
	Problem: 2038
	User: admin
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:1144 kb
****************************************************************/