#include <iostream>
using namespace std;
int main(void)
{
int t;
int n;
int arr[11] = { 1, 1, 2 };
cin >> t;
for (int i = 3; i < 11; i++)
arr[i] = arr[i - 1] + arr[i - 2] + arr[i - 3];
for (int i = 0; i < t; i++)
{
cin >> n;
cout << arr[n] << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpCnsKCWludCB0OwoJaW50IG47CglpbnQgYXJyWzExXSA9IHsgMSwgMSwgMiB9OwoKCWNpbiA+PiB0OwoJZm9yIChpbnQgaSA9IDM7IGkgPCAxMTsgaSsrKQoJCWFycltpXSA9IGFycltpIC0gMV0gKyBhcnJbaSAtIDJdICsgYXJyW2kgLSAzXTsKCglmb3IgKGludCBpID0gMDsgaSA8IHQ7IGkrKykKCXsKCQljaW4gPj4gbjsKCQljb3V0IDw8IGFycltuXSA8PCBlbmRsOwoJfQoJcmV0dXJuIDA7Cn0=