#include<stdio.h>
int main(){
int n;
scanf("%d", &n);
int a, b, c, d;
for(int i = 1; i <= n; ++i){
scanf("%d %d %d %d", &a, &b, &c, &d);
printf("%d %d %d %d ", a, b, c, d);
if(b-a == d-c)
printf("%d\n", d + b - a);
else
printf("%d\n", d*(b/a));
}
return 0;
}