#include<bits/stdc++.h>
#define sf scanf
#define pf printf
using namespace std;
int sum=0;
struct data
{
int x;
struct data *next;
};
typedef struct data nd;
nd *head = (nd*)malloc(sizeof(nd));
nd *start = head;
void takeIn()
{
int n;
nd *st = start;
while(sf("%d",&n))
{
sum += n;
if(!n)
{
st->next = NULL;
return;
}
st -> x = 2*n;
st -> next = (nd*)malloc(sizeof(nd));
st = st->next;
}
}
void out()
{
pf("Ordering: ");
nd *st= start;
while(st->next)
{
pf("%d ",st->x);
st = st->next;
}
}
int main()
{
int kase,m;
sf("%d",&kase);
while(kase--)
{
takeIn();
out();
pf("\nSum: %d",sum);
pf("\n");
sum=0;
}
return 0;
}