#include <cstdio>
#include <algorithm>

using namespace std;

long long v[128];

int main ()
{
    int n;
    scanf ("%d", &n);

    for (int i = 1; i <= n; ++i)
    {
        int x;
        scanf ("%d", &x);

        for (; x > 0; x /= 10)
            v[i] = v[i] * 10LL + 1LL * (x % 10);
    }

    for (int i = n; i; --i)
        printf ("%lld\n", v[i]);

    return 0;
}