#include <cstdio>
struct Heavy
{
Heavy() { printf("h "); }
Heavy(const Heavy&) { printf("H "); }
};
template<int N, class... Args> struct getter;
template<class A, class... Args> struct getter<0,A,Args...>
{
typedef A type;
static type get(A a, Args...) { printf("0 "); return a; }
};
template<int N, class A, class... Args> struct getter<N,A,Args...>
{
typedef getter<N-1,Args...> base;
typedef typename base::type type;
static type get(A a, Args... args) { printf("%d ", N); return base::get(args...); }
};
template<int N, class... Args>
typename getter<N,Args...>::type
get(Args... args) { printf("go "); return getter<N,Args...>::get(args...); }
int main()
{
get<4>(0,1,2,3,4, Heavy(), 6,7,8,9);
printf("\n");
get<5>(0,1,2,3,4, Heavy(), 6,7,8,9);
printf("\n");
get<9>(0,1,2,3,4, Heavy(), 6,7,8,9);
printf("\n");
}
I2luY2x1ZGUgPGNzdGRpbz4KCnN0cnVjdCBIZWF2eQp7CiAgICBIZWF2eSgpIHsgcHJpbnRmKCJoICIpOyB9CiAgICBIZWF2eShjb25zdCBIZWF2eSYpIHsgcHJpbnRmKCJIICIpOyB9Cn07Cgp0ZW1wbGF0ZTxpbnQgTiwgY2xhc3MuLi4gQXJncz4gc3RydWN0IGdldHRlcjsKdGVtcGxhdGU8Y2xhc3MgQSwgY2xhc3MuLi4gQXJncz4gc3RydWN0IGdldHRlcjwwLEEsQXJncy4uLj4KewogICAgdHlwZWRlZiBBIHR5cGU7CiAgICBzdGF0aWMgdHlwZSBnZXQoQSBhLCBBcmdzLi4uKSB7IHByaW50ZigiMCAiKTsgcmV0dXJuIGE7IH0KfTsKdGVtcGxhdGU8aW50IE4sIGNsYXNzIEEsIGNsYXNzLi4uIEFyZ3M+IHN0cnVjdCBnZXR0ZXI8TixBLEFyZ3MuLi4+CnsKICAgIHR5cGVkZWYgZ2V0dGVyPE4tMSxBcmdzLi4uPiBiYXNlOwogICAgdHlwZWRlZiB0eXBlbmFtZSBiYXNlOjp0eXBlIHR5cGU7CiAgICBzdGF0aWMgdHlwZSBnZXQoQSBhLCBBcmdzLi4uI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