#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<string.h>
using namespace std;
string ss;
void Dragon(const string& s, int n)
{
if (n == 0)
{
ss += s;
return;
}
for (int i = 0; i<s.size(); i++)
{
if (s[i] == 'X')
Dragon("X+YF", n - 1);
else
if (s[i] == 'Y')
Dragon("FX-Y", n - 1);
else
ss += s[i];
}
}
void print(int p, int l)
{
for (int i = 0; i<l; i++)
{
int k = p + i;
if (k % 6 == 2)
cout << "X";
else
if (k % 6 == 4)
cout << "Y";
else
if (k % 3 == 0)
{
k = k / 3;
while (k % 2 == 0)
{
k /= 2;
}
if ((k - 3) % 4 == 0)
{
cout << "-";
}
else
cout << "+";
}
else
cout << "F";
}
cout << endl;
}
int main()
{
int t;
scanf("%d", &t);
while (t--)
{
ss = "";
string s;
int n;
s = "FX";
int p, l;
scanf("%d%d%d", &n, &p, &l);
print(p, l);
}
return 0;
}