#include using namespace std; #define pb push_back #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define sz size() #define forn(i,m) for(int i=0;i<(int)(m);i++) #define fornn(i,n,m) for(int i=n;i<(int)(m);i++) #define forb(i,n,m) for(int i=n;i>=(int)(m);i--) #define forit(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();++it) #define mem(a,b) memset(a,b,sizeof(a)) #define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr) #define pw(x) (1LL<<(x)) #define DBGV(vari) cerr << #vari<< " = "<< (vari) < pii; typedef vector vpii; typedef vector vs; typedef vector vi; typedef vector vd; typedef vector > vvi; typedef long long ll; typedef long double ld; typedef vector vll; typedef pair pdd; typedef pair pll; typedef vector vpll; typedef vector vvpll; inline int nextint(){ int x; scanf("%d",&x); return x; } inline ll nextll() { ll x; scanf("%lld",&x); return x; } #define gc getchar template void scanint(T &x) { T c = gc(); while(((c < 48) || (c > 57)) && (c!='-')) c = gc(); bool neg = false; if(c == '-') {neg = true; c = gc();} x = 0; for(;c < 48 || c > 57;c=gc()); for(;c > 47 && c < 58;c=gc()) x = (x*10) + (c - 48); if(neg) x = -x; } // variadics templateT min_ ( T a , T b ) { return a > b ? b : a ; } template < typename T , typename... Ts > T min_( T first , Ts... last ){ return min_(first, min_(last...)); } templateT max_ ( T a , T b ) { return a > b ? b : a ; } template < typename T , typename... Ts > T max_( T first , Ts... last ){ return max_(first, max_(last...)); } // lambda exp auto square = [](int inp) { return inp * inp; } ; template std::ostream& operator<<(std::ostream &os, const std::pair &t) { os<<"("< ostream& operator<< (ostream& out, const vector& v) { out << "["; size_t last = v.size() - 1; for(size_t i = 0; i < v.size(); ++i) { out << v[i]; if (i != last) out << ", "; } out << "]"; return out; } template ostream& operator<< (ostream& out, const set& v) { out << "{"; auto last = v.end(); for(auto i = v.begin(); i != last;) { out << *i; if (++i != last) out << ", "; } out << "}"; return out; } template ostream& operator<< (ostream& out, const map& v) { out << "{"; auto last = v.end(); for(auto i = v.begin(); i != last;) { out << *i; if (++i != last) out << ", "; } out << "}"; return out; } template void trace(std::ostream& out, Arg&& arg, Args&&... args) { out<<"<< "; out << std::forward(arg); using expander = int[]; (void)expander{0, (void(out << ", " << std::forward(args)),0)...}; out<<" >>\n"; } ll pwr(ll base, ll p, ll mod){ ll ans = 1; while(p) { if(p&1) ans=(ans*base)%mod; base=(base*base)%mod; p/=2; } return ans; } ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b,a%b); } ll lcm(ll a, ll b) { return a*(b/gcd(a,b)); } const long double PI = (long double)(3.1415926535897932384626433832795); const ll mx_ll = numeric_limits :: max(); const int mx_int = numeric_limits :: max(); const int mod = 1e9+7; const int oo = 0x3f3f3f3f; const ll OO = 0x3f3f3f3f3f3f3f3fll; const double eps = 1e-9; const int dx[6]={-1,1 ,2 ,1 ,-1,-2}; const int dy[6]={-2,-2,0 ,2 ,2 ,0 }; /*************************************************************************/ const int maxn=205; const string mouves[6]={"UL", "UR", "R", "LR", "LL", "L"}; int n; int sy, sx, ey, ex; int board[maxn][maxn]; map vis; map previous; map mouve; bool found=false; void _input(){ cin>>n; cin>>sy>>sx>>ey>>ex; } /*typedef struct { int py, px; int count; string mouve; } Node;*/ bool isValid(int y, int x){ return !(y<0 or x<0 or y>=n or x>=n); } void _solve(){ queue q; pii start = pii(sy,sx); q.push(start); vis[start]++; while(q.size()){ if(found) break; pii curr = q.front(); q.pop(); //debug2(curr.first,curr.second); if(curr.first==ey and curr.second==ex){ found=true; break; } forn(i,6){ pii next = pii(curr.first+dy[i],curr.second+dx[i]); //debug2(next.first,next.second); if(!isValid(next.first,next.second)) continue; if(!vis[next]++){ previous[next]= curr; mouve[next]= mouves[i]; q.push(next); } if(next.first==ey and next.second==ex){ found=true; } } } if(!found) cout<<"Impossible"< ans; pii end = pii(ey,ex); while(end!=start){ ans.push(mouve[end]); end=previous[end]; } cout<>qq; while(qq--){ _input(); _solve(); } } /*************************************************************************/