#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
bool flipped=0;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,-1,1};
int dj[] = {-1,1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m); flipped^=1;
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x>>y;
	if (flipped) swap(x,y);
	x--;y--;
	if (board[x][y]=='F') exit(0);
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[0][1] == '*')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	x = 0, y = 0;
	move(0);
	if (y) swap(Dir[0],Dir[1]),move(0);
	while (board[1][y] == '*')
		move(1);
	move(2);
	if (x) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,-1,1};
int dj[] = {-1,1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m);
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x;
	if (x==-1) exit(0);
	cin>>y;
	x--;y--;
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[0][1] == '*')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	x = 0, y = 0;
	move(0);
	if (y) swap(Dir[0],Dir[1]),move(0);
	while (board[1][y] == '*') {
		if (board[x][y] == 'F') return 0;
		move(1);
	}
	move(2);
	if (x) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,-1,1};
int dj[] = {-1,1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m);
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x>>y;
	x--;y--;
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

const int DEBUG = 0;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	if (DEBUG) freopen("input.txt", "r", stdin);
	if (DEBUG) freopen("output.txt", "w", stdout);
#endif
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[1][0] != '*')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	x = 0, y = 0;
	move(0);
	if (y) swap(Dir[0],Dir[1]),move(0);
	while (board[1][y] == '*') move(1);
	move(2);
	if (x) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,1,-1};
int dj[] = {1,-1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m);
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x>>y;
	x--;y--;
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[1][0] == '.')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	x = 0, y = 0;
	move(0);
	if (x) swap(Dir[0],Dir[1]),move(0);
	while (board[x][1] == '*') move(1);
	move(2);
	if (y) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,1,-1};
int dj[] = {1,-1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m);
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x>>y;
	x--;y--;
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[1][0] == '.')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	int x = 0, y = 0;
	move(0);
	if (x) swap(Dir[0],Dir[1]),move(0);
	while (board[x][1] != '.') move(1);
	move(2);
	if (y) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,-1,1};
int dj[] = {-1,1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m);
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x>>y;
	x--;y--;
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

const int DEBUG = 0;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	if (DEBUG) freopen("input.txt", "r", stdin);
	if (DEBUG) freopen("output.txt", "w", stdout);
#endif
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[1][0] != '*')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	x = 0, y = 0;
	move(0);
	if (y) swap(Dir[0],Dir[1]),move(0);
	while (board[0][y] == '*') move(1);
	move(2);
	if (x) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,a,b) for(int i=b-1;i>=a;i--)
#define IN(i,a,b) (a<=i&&i<=b)
#define pb push_back
#define flush fflush(stdout)

const int mxn = 100;
int n,m,x,y;
char board[mxn][mxn];
bool vis[mxn][mxn];
string Dir = "LRUD";
int di[] = {0,0,1,-1};
int dj[] = {1,-1,0,0};
vector<int> moves;

bool valid(int i, int j) {
	return IN(i,0,n-1)&&IN(j,0,m-1)&&!vis[i][j]&&board[i][j] != '*';
}

void invert() {
	f(i,0,n) f(j,i+1,m)
		swap(board[i][j],board[j][i]);
	swap(n,m);
	Dir = "UDLR";
}

void move(int i) {
	cout << Dir[i] << endl;
	flush;
	cin>>x>>y;
	x--;y--;
}

bool dfs(int i, int j) {
	if (board[i][j] == 'F') return 1;
	vis[i][j] = 1;
	f(k,0,4) {
		int ni = i+di[k], nj = j+dj[k];
		moves.pb(k);
		if (valid(ni,nj) && dfs(ni,nj)) return 1;
		moves.pop_back();
	}
	return 0;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
	f(i,0,n) f(j,0,m) cin>>board[i][j];
	if (board[1][0] == '.')
		invert();
	f(i,0,n) f(j,0,m) vis[i][j]=0;
	x = 0, y = 0;
	move(0);
	if (x) swap(Dir[0],Dir[1]),move(0);
	while (board[x][1] != '.') move(1);
	move(2);
	if (y) swap(Dir[2],Dir[3]);
	dfs(x,y);
	f(i,0,moves.size())
		move(moves[i]);
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

string ans;
int n, m, f;
vector <bool> used;
vector <vector <char>> table;
vector <vector <pair <int, char>>> g;

void add_edge(int r1, int c1, int r2, int c2) {
  if (r1 >= n || r2 >= n || c1 >= m || c2 >= m)
    return;
  if (r1 < 0 || c1 < 0 || r2 < 0 || c2 < 0)
    return;
  if (table[r1][c1] == '*' || table[r2][c2] == '*')
    return;
  int u = r1 * m + c1;
  int v = r2 * m + c2;
  if (v == u + m) {
    g[u].push_back({v, 'D'});
    g[v].push_back({u, 'U'});
  } else {
    g[u].push_back({v, 'R'});
    g[v].push_back({u, 'L'});
  }
}

void dfs(int v, string &x) {
  if (v == f)
    ans = x;
  used[v] = true;
  for (auto &now : g[v]) {
    int u = now.first;
    char c = now.second;
    if (used[u])
      continue;
    x += c;
    dfs(u, x);
    x.pop_back();
  }
}

int main() {
  cin >> n >> m;
  table = vector <vector <char>>(n, vector <char>(m));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> table[i][j];
      if (table[i][j] == 'F')
        f = i * m + j;
    }
  g.resize(n * m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      add_edge(i, j, i + 1, j);
      add_edge(i, j, i, j + 1);
    }
  used.resize(n * m);
  string x = "";
  dfs(0, x);
  int swapLR = -1, swapUD = -1;
  int a = 1, b = 1;
  for (char c : ans) {
    if (c == 'L' || c == 'R') {
      if (swapLR == -1) {
        cout << c << endl;
        int newa, newb;
        cin >> newa >> newb;
        if (newa == a && newb == b) {
          swapLR = 1;
        } else {
          swapLR = 0;
          continue;
        }
      }
      if (swapLR == 0) {
        cout << c << endl;
        cin >> a >> b;
      }
      if (swapLR == 1) {
        if (c == 'L')
          c = 'R';
        else
          c = 'L';
        cout << c << endl;
        cin >> a >> b;
      }
    } else {
      if (swapUD == -1) {
        cout << c << endl;
        int newa, newb;
        cin >> newa >> newb;
        if (newa == a && newb == b) {
          swapUD = 1;
        } else {
          swapUD = 0;
          continue;
        }
      }
      if (swapUD == 0) {
        cout << c << endl;
        cin >> a >> b;
      }
      if (swapUD == 1) {
        if (c == 'U')
          c = 'D';
        else
          c = 'U';
        cout << c << endl;
        cin >> a >> b;
      }
    }
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
char a[4]={'L','R','U','D'};
ll vis[105][105],n,m,ax,ay,f;
vector<p2> path;
p2 inp(char c){
	ll x,y;
	cout<<c<<"\n";
	fflush(stdout);
	cin>>x>>y;
	return {x-1,y-1};
}
void dfs(ll i,ll j,vector<string> &v){
	vis[i][j]=1;
	if(i==ax&&j==ay){
		f=1;
		return;
	}
	if(i>0&&vis[i-1][j]==0&&v[i-1][j]!='*'){
		dfs(i-1,j,v);
		if(f){
			path.push_back({i-1,j});
			return;
		}
	}
	if(i<n-1&&vis[i+1][j]==0&&v[i+1][j]!='*'){
		dfs(i+1,j,v);
		if(f){
			path.push_back({i+1,j});
			return;
		}
	}
	if(j>0&&vis[i][j-1]==0&&v[i][j-1]!='*'){
		dfs(i,j-1,v);
		if(f){
			path.push_back({i,j-1});
			return;
		}
	}
	if(j<m-1&&vis[i][j+1]==0&&v[i][j+1]!='*'){
		dfs(i,j+1,v);
		if(f){
			path.push_back({i,j+1});
			return;
		}
	}
}
void solve(){
	cin>>n>>m;
	vector<string> v(n);
	for(ll i=0;i<n;i++){
		cin>>v[i];
		for(ll j=0;j<m;j++)
		if(v[i][j]=='F'){
			ax=i;
			ay=j;
		}
	}
	dfs(0,0,v);
	path.push_back({0,0});
	reverse(path.begin(),path.end());
	ll x0=0,y0=0,f1=0,f2=0;
	for(ll i=1;i<ll(path.size());i++){
		if(path[i].second>path[i-1].second){
			if(!f1){
				p2 x=inp(a[1]);
				if(x.second!=y0+1){
				    swap(a[0],a[1]);
				    inp(a[1]);
				    if(x.second==y0-1)
				    inp(a[1]);
			    }
				f1=1;
			}
			else
			inp(a[1]);
			y0++;
		}
		else if(path[i].second<path[i-1].second){
			if(!f1){
				p2 x=inp(a[0]);
				if(x.second!=y0-1){
				    swap(a[0],a[1]);
				    inp(a[0]);
				    if(x.second==y0+1)
				    inp(a[0]);
			    }
				f1=1;
			}
			else
			inp(a[0]);
			y0--;
		}
		else if(path[i].first>path[i-1].first){
			if(!f2){
				p2 x=inp(a[3]);
				if(x.first!=x0+1){
					swap(a[2],a[3]);
					inp(a[3]);
					if(x.first==x0-1)
					inp(a[3]);
				}
				f2=1;
			}
			else
			inp(a[3]);
			x0++;
		}
		else{
			if(!f2){
				p2 x=inp(a[3]);
				if(x.first!=x0-1){
					swap(a[2],a[3]);
					inp(a[2]);
					if(x.first==x0+1)
					inp(a[2]);
				}
				f2=1;
			}
			else
			inp(a[2]);
			x0--;
		}
	}
}
int main(){
    /*ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);*/
    ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;

bool REAL_SWAP_LR = true;
bool REAL_SWAP_UD = true;

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
//    if (REAL_SWAP_UD) {
//        dx *= -1;
//    }
//    if (REAL_SWAP_LR) {
//        dy *= -1;
//    }
//    if (!ok(x + dx, y + dy)) {
//        return;
//    }
//    if (a[x + dx][y + dy] == '*') {
//        cerr << "LOSE" << endl;
//        exit(0);
//    }
//    if (a[x + dx][y + dy] == 'F') {
//        cerr << "WIN" << endl;
//        exit(0);
//    }
//    x += dx;
//    y += dy;
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] == '.') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] == '.') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (true) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
        if (cx == sx && cy == sy) {
            break;
        }
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    //#ifdef LOCAL
    //assert(freopen("input.txt", "r", stdin));
    //assert(freopen("output.txt", "w", stdout));
    //#endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        cin >> t;
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;

bool REAL_SWAP_LR = true;
bool REAL_SWAP_UD = true;

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
//    if (REAL_SWAP_UD) {
//        dx *= -1;
//    }
//    if (REAL_SWAP_LR) {
//        dy *= -1;
//    }
//    if (!ok(x + dx, y + dy)) {
//        return;
//    }
//    if (a[x + dx][y + dy] == '*') {
//        cerr << "LOSE" << endl;
//        exit(0);
//    }
//    if (a[x + dx][y + dy] == 'F') {
//        cerr << "WIN" << endl;
//        exit(0);
//    }
//    x += dx;
//    y += dy;
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x > 0 && y > 0);
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] == '.') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] == '.') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (true) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
        if (cx == sx && cy == sy) {
            break;
        }
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        cin >> t;
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;
//
//bool REAL_SWAP_LR = true;
//bool REAL_SWAP_UD = false;

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
//    if (REAL_SWAP_UD) {
//        dx *= -1;
//    }
//    if (REAL_SWAP_LR) {
//        dy *= -1;
//    }
//    if (!ok(x + dx, y + dy)) {
//        return;
//    }
//    if (a[x + dx][y + dy] == '*') {
//        cerr << "LOSE" << endl;
//        exit(0);
//    }
//    if (a[x + dx][y + dy] == 'F') {
//        cerr << "WIN" << endl;
//        exit(0);
//    }
//    x += dx;
//    y += dy;

    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] == '.') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] == '.') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (cx != sx || cy != sy) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        cin >> t;
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;
//
//bool REAL_SWAP_LR = true;
//bool REAL_SWAP_UD = false;

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
//    if (REAL_SWAP_UD) {
//        dx *= -1;
//    }
//    if (REAL_SWAP_LR) {
//        dy *= -1;
//    }
//    if (!ok(x + dx, y + dy)) {
//        return;
//    }
//    if (a[x + dx][y + dy] == '*') {
//        cerr << "LOSE" << endl;
//        exit(0);
//    }
//    if (a[x + dx][y + dy] == 'F') {
//        cerr << "WIN" << endl;
//        exit(0);
//    }
//    x += dx;
//    y += dy;

    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] == '.') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] == '.') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (cx != sx || cy != sy) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        for (int i = 0; i < m; i++) {
            char c;
            cin >> c;
            t.push_back(c);
        }
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;

#ifdef LOCAL
bool REAL_SWAP_LR = true;
bool REAL_SWAP_UD = false;
#endif

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
#ifdef LOCAL
    if (REAL_SWAP_UD) {
        dx *= -1;
    }
    if (REAL_SWAP_LR) {
        dy *= -1;
    }
    if (!ok(x + dx, y + dy)) {
        return;
    }
    if (a[x + dx][y + dy] == '*') {
        cerr << "LOSE" << endl;
        exit(0);
    }
    if (a[x + dx][y + dy] == 'F') {
        cerr << "WIN" << endl;
        exit(0);
    }
    x += dx;
    y += dy;
#else
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
#endif
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] != '*') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] != '*') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (cx != sx || cy != sy) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
#ifdef LOCAL
    if (swap_lr != REAL_SWAP_LR || swap_ud != REAL_SWAP_UD) {
        cerr << "WRRONG SWAPS" << endl;
    }
#endif
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
    cerr << "LOSE" << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        for (int i = 0; i < m; i++) {
            char c;
            cin >> c;
            t.push_back(c);
        }
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;

bool REAL_SWAP_LR = true;
bool REAL_SWAP_UD = true;

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
//    if (REAL_SWAP_UD) {
//        dx *= -1;
//    }
//    if (REAL_SWAP_LR) {
//        dy *= -1;
//    }
//    if (!ok(x + dx, y + dy)) {
//        return;
//    }
//    if (a[x + dx][y + dy] == '*') {
//        cerr << "LOSE" << endl;
//        exit(0);
//    }
//    if (a[x + dx][y + dy] == 'F') {
//        cerr << "WIN" << endl;
//        exit(0);
//    }
//    x += dx;
//    y += dy;
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] == '.') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] == '.') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (true) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
        if (cx == sx && cy == sy) {
            break;
        }
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        cin >> t;
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;

#ifdef LOCAL
bool REAL_SWAP_LR = false;
bool REAL_SWAP_UD = true;
#endif

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
#ifdef LOCAL
    if (REAL_SWAP_UD) {
        dx *= -1;
    }
    if (REAL_SWAP_LR) {
        dy *= -1;
    }
    if (!ok(x + dx, y + dy)) {
        return;
    }
    if (a[x + dx][y + dy] == '*') {
        cerr << "LOSE" << endl;
        exit(0);
    }
    if (a[x + dx][y + dy] == 'F') {
        cerr << "WIN" << endl;
        exit(0);
    }
    x += dx;
    y += dy;
#else
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
#endif
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    bool calc = false;
    if (m > 1) {
        if (a[0][1] != '*') {
            calc = true;
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    }
    if (n > 1 && !calc) {
        if (a[1][0] != '*') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (cx != sx || cy != sy) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
#ifdef LOCAL
    if (swap_lr != REAL_SWAP_LR || swap_ud != REAL_SWAP_UD) {
        cerr << "WRRONG SWAPS" << endl;
    }
#endif
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
    cerr << "LOSE" << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        for (int i = 0; i < m; i++) {
            char c;
            cin >> c;
            t.push_back(c);
        }
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;
//
//bool REAL_SWAP_LR = true;
//bool REAL_SWAP_UD = false;

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
//    if (REAL_SWAP_UD) {
//        dx *= -1;
//    }
//    if (REAL_SWAP_LR) {
//        dy *= -1;
//    }
//    if (!ok(x + dx, y + dy)) {
//        return;
//    }
//    if (a[x + dx][y + dy] == '*') {
//        cerr << "LOSE" << endl;
//        exit(0);
//    }
//    if (a[x + dx][y + dy] == 'F') {
//        cerr << "WIN" << endl;
//        exit(0);
//    }
    x += dx;
    y += dy;
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    if (m > 1) {
        if (a[0][1] == '.') {
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    } else if (n > 1) {
        if (a[1][0] == '.') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (cx != sx || cy != sy) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
    a.resize(n);
    for (auto &t : a) {
        cin >> t;
    }
    solve();
}


#include <bits/stdc++.h>

using namespace std;

const int INF = 1e6 + 239;

int n, m;
int x, y;
vector<string> a;

#ifdef LOCAL
int REAL_SWAP_LR;
int REAL_SWAP_UD;
#endif

bool ok(int i, int j) {
    return i >= 0 && i < n && j >= 0 && j < m;
}

void query(int dx, int dy) {
#ifdef LOCAL
    if (REAL_SWAP_UD) {
        dx *= -1;
    }
    if (REAL_SWAP_LR) {
        dy *= -1;
    }
    if (!ok(x + dx, y + dy)) {
        return;
    }
    if (a[x + dx][y + dy] == '*') {
        cerr << "LOSE" << endl;
        exit(0);
    }
    if (a[x + dx][y + dy] == 'F') {
        cerr << "WIN" << endl;
        exit(0);
    }
    x += dx;
    y += dy;
    assert(x >= 0 && y >= 0 && x < n && y < m);
#else
    if (dx == 0 && dy == 1) {
        cout << 'R' << endl;
    } else if (dx == 0 && dy == -1) {
        cout << 'L' << endl;
    } else if (dx == 1 && dy == 0) {
        cout << 'D' << endl;
    } else {
        cout << 'U' << endl;
    }
    cin >> x >> y;
    x--;
    y--;
    assert(x >= 0 && y >= 0);
    if (a[x][y] == 'F') {
        exit(0);
    }
#endif
}

void go(int dx, int dy, int &swap_lr, int &swap_ud) {
    if (swap_lr) {
        dy *= -1;
    }
    if (swap_ud) {
        dx *= -1;
    }
    query(dx, dy);
}

void init(int &swap_lr, int &swap_ud) {
    swap_lr = false;
    swap_ud = false;
    bool calc = false;
    if (m > 1) {
        if (a[0][1] != '*') {
            calc = true;
            go(0, 1, swap_lr, swap_ud);
            if (y == 0) {
                swap_lr = 1;
            } else {
                swap_lr = 0;
                go(0, -1, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[1][y] == '*') {
                    go(0, 1, swap_lr, swap_ud);
                }
                //
                go(1, 0, swap_lr, swap_ud);
                if (x == 0) {
                    swap_ud = 1;
                } else {
                    swap_ud = 0;
                }
            }
        }
    }
    if (n > 1 && !calc) {
        if (a[1][0] != '*') {
            go(1, 0, swap_lr, swap_ud);
            if (x == 0) {
                swap_ud = 1;
            } else {
                swap_ud = 0;
                go(-1, 0, swap_lr, swap_ud);
            }
            if (n > 1) {
                while (a[x][1] == '*') {
                    go(1, 0, swap_lr, swap_ud);
                }
                //
                go(0, 1, swap_lr, swap_ud);
                if (y == 0) {
                    swap_lr = 1;
                } else {
                    swap_lr = 0;
                }
            }
        }
    }
}

void bfs(int sx, int sy, int ex, int ey, vector<pair<int, int>> &ans) {
    vector<int> dx = {0, 0, 1, -1};
    vector<int> dy = {-1, 1, 0, 0};
    vector<vector<int>> d(n, vector<int> (m, INF));
    vector<vector<pair<int, int>>> p(n, vector<pair<int, int>> (m, {-1, -1}));
    queue<pair<int, int>> q;
    d[sx][sy] = 0;
    q.push({sx, sy});
    while (!q.empty()) {
        auto c = q.front();
        q.pop();
        int cx = c.first;
        int cy = c.second;
        for (int i = 0; i < 4; i++) {
            int nx = cx + dx[i];
            int ny = cy + dy[i];
            if (ok(nx, ny) && d[nx][ny] > d[cx][cy] + 1 && a[nx][ny] != '*') {
                d[nx][ny] = d[cx][cy] + 1;
                p[nx][ny] = {cx, cy};
                q.push({nx, ny});
            }
        }
    }
    assert(d[ex][ey] != INF);
    int cx = ex;
    int cy = ey;
    vector<pair<int, int>> path = {{cx, cy}};
    while (cx != sx || cy != sy) {
        auto pr = p[cx][cy];
        cx = pr.first;
        cy = pr.second;
        path.push_back({cx, cy});
    }
    reverse(path.begin(), path.end());
    ans.clear();
    for (int i = 0; i + 1 < (int)path.size(); i++) {
        ans.push_back({path[i + 1].first - path[i].first, path[i + 1].second - path[i].second});
    }
}

void solve() {
    x = 0;
    y = 0;
    //
    int ex = -1;
    int ey = -1;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'F') {
                ex = i;
                ey = j;
            }
        }
    }
    //
    int swap_lr = 0;
    int swap_ud = 0;
    init(swap_lr, swap_ud);
#ifdef LOCAL
    if (swap_lr != REAL_SWAP_LR || swap_ud != REAL_SWAP_UD) {
        cerr << "WRRONG SWAPS" << endl;
    }
#endif
    vector<pair<int, int>> g;
    bfs(x, y, ex, ey, g);
    //
    for (auto [f, s] : g) {
        go(f, s, swap_lr, swap_ud);
    }
    cerr << "LOSE" << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    #ifdef LOCAL
    assert(freopen("input.txt", "r", stdin));
    assert(freopen("output.txt", "w", stdout));
    #endif

    cin >> n >> m;
#ifdef LOCAL
    cin >> REAL_SWAP_LR >> REAL_SWAP_UD;
#endif
    a.resize(n);
    for (auto &t : a) {
        for (int i = 0; i < m; i++) {
            char c;
            cin >> c;
            t.push_back(c);
        }
    }
    solve();
}


#include <bits/stdc++.h>
using namespace std;

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

vs grid;

pii op(char dir) {
    cout << dir << endl;
    int x, y; re(x, y); --x, --y;
    if (grid[x][y] == 'F') exit(0);
    return {x, y};
}

int main() {
    setIO();

    int N, M; re(N, M);
    grid.resz(N); re(grid);

    assert(grid[0][0] == '.');

    pii loc = {0,0};
    auto  down = [&](){ return loc.f+1 < N && grid[loc.f+1][loc.s] != '*'; };
    auto right = [&](){ return loc.s+1 < M && grid[loc.f][loc.s+1] != '*'; };

    char D = 'D', U = 'U', L = 'L', R = 'R';

    if (down()) {
        pii nloc = op(D);
        if (nloc == loc) swap(D, U);
        else op(U);
        while (!right()) loc = op(D);
        nloc = op(R);
        if (nloc == loc) swap(L, R);
        else loc = nloc;
    } else {
        assert(right());
        pii nloc = op(R);
        if (nloc == loc) swap(L, R);
        else op(L);
        while (!down()) loc = op(R);
        nloc = op(D);
        if (nloc == loc) swap(U, D);
        else loc = nloc;
    }

    vvi reach(N, vi(M, -1));
    reach[loc.f][loc.s] = -2;

    auto go = [&](int r, int c) {
        return r >= 0 && r < N && c >= 0 && c < M && grid[r][c] != '*' && !~reach[r][c];
    };

    for (queue<pii> bfs({loc}); !bfs.empty(); bfs.pop()) {
        auto [r, c] = bfs.front();
        if (go(r+1, c)) { reach[r+1][c] = D; bfs.push({r+1, c}); }
        if (go(r-1, c)) { reach[r-1][c] = U; bfs.push({r-1, c}); }
        if (go(r, c+1)) { reach[r][c+1] = R; bfs.push({r, c+1}); }
        if (go(r, c-1)) { reach[r][c-1] = L; bfs.push({r, c-1}); }
    }

    int fr = -1, fc = -1;
    F0R (r, N) F0R (c, M) if (grid[r][c] == 'F') fr = r, fc = c;
    assert(~fr && ~reach[fr][fc]);

    string ops;
    while (loc != pii{fr, fc}) {
        char mv = reach[fr][fc];
        ops.pb(mv);
        if      (mv == D) fr--;
        else if (mv == U) fr++;
        else if (mv == L) fc++;
        else              fc--;
    }

    reverse(all(ops));
    trav (e, ops) op(e);

    assert(false);

    // did you check N=1? did you mix up N,M?
    return 0;
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#define ll long long
#define elif else if
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define append push_back
#define pb push_back
#define str to_string
#define gcd __gcd
#define optimise cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
using namespace std;
const ll MOD = 998244353;
ll n,m;
char arr[1000][1000];
string ans;
void query(char out,ll&x,ll&y){cout<<out<<endl;fflush(stdout);cin>>x>>y;}
void dfs(ll x,ll y,string path){
    if(arr[x][y]=='F'){ans=path;return;}
    arr[x][y]='*';
    if(x+1<n && arr[x+1][y]!='*')dfs(x+1,y,path+'D');
    if(y+1<m && arr[x][y+1]!='*')dfs(x,y+1,path+'R');
    if(y     && arr[x][y-1]!='*')dfs(x,y-1,path+'L');
    if(x     && arr[x-1][y]!='*')dfs(x-1,y,path+'U');
}
void solve()
{
    cin>>n>>m;
    for(ll i=0;i<n;i++)cin>>arr[i];
    ll nx,ny;
    ll flagH=0,flagV=0,startx=0,starty=0;
    if(arr[0][1]==arr[1][0]){
        ll x,y;query('D',x,y);
        if(x!=y)query('U',nx,ny);
        else flagV=1;
        query('R',x,y);
        if(x!=y)query('L',x,y);
        else flagH=1;
    }
    elif(arr[0][1]=='.'){
        ll x,y;query('R',x,y);
        char pr='R';
        if(x==y)flagH=-1,pr='L';
        else query('L',x,y);
        x--;y--;
        while(arr[1][y]=='*')y+=1,query(pr,nx,ny);
        ll qx,qy;query('D',qx,qy);
        if(arr[1][y]=='F'){
            if(qx==x+1)query('U',nx,ny);
            return;}
        if(qx!=x+1)query('U',nx,ny);
        else flagV=1;
        startx=x,starty=y;
    }
    else{
        ll x,y;query('D',x,y);
        char pr='D';
        if(x==y)flagV=1,pr='U';
        else query('U',x,y);
        x--;y--;
        while(arr[x][1]=='*')x+=1,query(pr,nx,ny);
        ll qx,qy;query('R',qx,qy);
        if(arr[x][1]=='F'){
            if(qy==y+1)query('L',nx,ny);
            return;}
        if(qy!=y+1)query('L',nx,ny);
        else flagH=1;
        startx=x,starty=y;
    }
    dfs(startx,starty,"");
    map<char,char>cntrls={{'U','U'},{'R','R'},{'L','L'},{'D','D'}};
    if(flagH)cntrls['R']='L',cntrls['L']='R';
    if(flagV)cntrls['U']='D',cntrls['D']='U';
    for(auto&i:ans)query(cntrls[i],nx,ny);
}
int main()
{
    optimise
    ll t=1;
    while(t--)solve();
}
/*
10 10
.*********
.*********
..********
*.********
*.********
*F********
**********
**********
**********
**********

 */


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#define ll long long
#define elif else if
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define append push_back
#define pb push_back
#define str to_string
#define gcd __gcd
#define optimise cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
using namespace std;
const ll MOD = 998244353;
ll n,m;
char arr[1000][1000];
string ans;
void query(char out,ll&x,ll&y){cout<<out<<endl;fflush(stdout);cin>>x>>y;}
void dfs(ll x,ll y,string path){
    if(arr[x][y]=='F'){ans=path;return;}
    arr[x][y]='*';
    if(x+1<n && arr[x+1][y]!='*')dfs(x+1,y,path+'D');
    if(y+1<m && arr[x][y+1]!='*')dfs(x,y+1,path+'R');
    if(y     && arr[x][y-1]!='*')dfs(x,y-1,path+'L');
    if(x     && arr[x-1][y]!='*')dfs(x-1,y,path+'U');
}
void solve()
{
    cin>>n>>m;
    for(ll i=0;i<n;i++)cin>>arr[i];
    ll nx,ny;
    ll flagH=0,flagV=0,startx=0,starty=0;
    if(arr[0][1]==arr[1][0]){
        ll x,y;query('D',x,y);
        if(x!=y)query('U',nx,ny);
        else flagV=1;
        query('R',x,y);
        if(x!=y)query('L',x,y);
        else flagH=1;
    }
    elif(arr[0][1]=='.'){
        ll x,y;query('R',x,y);
        char pr='R';
        if(x==y)flagH=-1,pr='L';
        x--;y--;
        while(arr[1][y]=='*')y+=1,query(pr,x,y);
        ll qx,qy;query('D',qx,qy);
        if(arr[1][y]=='F'){
            if(qx==x+1)query('U',nx,ny);
            return;}
        if(qx!=x+1)query('U',nx,ny);
        else flagV=1;
        startx=x,starty=y;
    }
    else{
        ll x,y;query('D',x,y);
        char pr='D';
        if(x==y)flagV=1,pr='U';
        else query('U',x,y);
        x--;y--;
        while(arr[x][1]=='*')x+=1,query(pr,nx,ny);
        ll qx,qy;query('R',qx,qy);
        if(arr[x][1]=='F'){
            if(qy==y+1)query('L',nx,ny);
            return;}
        if(qy!=y+1)query('L',nx,ny);
        else flagH=1;
        startx=x,starty=y;
    }
    dfs(startx,starty,"");
    map<char,char>cntrls={{'U','U'},{'R','R'},{'L','L'},{'D','D'}};
    if(flagH)cntrls['R']='L',cntrls['L']='R';
    if(flagV)cntrls['U']='D',cntrls['D']='U';
    for(auto&i:ans)query(cntrls[i],nx,ny);
}
int main()
{
    optimise
    ll t=1;
    while(t--)solve();
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#define ll long long
#define elif else if
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define append push_back
#define pb push_back
#define str to_string
#define gcd __gcd
#define optimise cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
using namespace std;
const ll MOD = 998244353;ll n,m;char arr[1000][1000];string ans;
void query(char out,ll&x,ll&y){cout<<out<<endl;fflush(stdout);cin>>x>>y;}
void dfs(ll x,ll y,string path){
    if(arr[x][y]=='F'){ans=path;return;}arr[x][y]='*';
    if(x+1<n && arr[x+1][y]!='*')dfs(x+1,y,path+'D');
    if(y+1<m && arr[x][y+1]!='*')dfs(x,y+1,path+'R');
    if(y     && arr[x][y-1]!='*')dfs(x,y-1,path+'L');
    if(x     && arr[x-1][y]!='*')dfs(x-1,y,path+'U');}
void solve(){
    cin>>n>>m;
    for(ll i=0;i<n;i++)cin>>arr[i];
    ll nx,ny;
    ll flagH=0,flagV=0,startx=0,starty=0;
    if(arr[0][1]==arr[1][0]){
        ll x,y;query('D',x,y);
        if(x!=y){query('U',nx,ny);}else{flagV=1;}query('R',x,y);
        if(x!=y){query('L',x,y);}else{flagH=1;}}
    elif(arr[0][1]=='.'){
        ll x,y;query('R',x,y);char pr='R';
        if(x==y){flagH=-1,pr='L';}else{query('L',x,y);}x--;y--;
        while(arr[1][y]=='*')y+=1,query(pr,nx,ny);ll qx,qy;query('D',qx,qy);
        if(arr[1][y]=='F'){if(qx==x+1)query('U',nx,ny);return;}
        if(qx!=x+1)query('U',nx,ny);else{flagV=1;}
        startx=x,starty=y;}
    else{
        ll x,y;query('D',x,y);char pr='D';
        if(x==y){flagV=1,pr='U';}else{query('U',x,y);}x--;y--;
        while(arr[x][1]=='*')x+=1,query(pr,nx,ny);ll qx,qy;query('R',qx,qy);
        if(arr[x][1]=='F'){if(qy==y+1)query('L',nx,ny);return;}
        if(qy!=y+1){query('L',nx,ny);}else{flagH=1;}startx=x,starty=y;}
    dfs(startx,starty,"");map<char,char>cntrls={{'U','U'},{'R','R'},{'L','L'},{'D','D'}};
    if(flagH)cntrls['R']='L',cntrls['L']='R';if(flagV)cntrls['U']='D',cntrls['D']='U';for(auto&i:ans)query(cntrls[i],nx,ny);}
int main(){
    optimise
    ll t=1;while(t--)solve();}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#define ll long long
#define elif else if
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define append push_back
#define pb push_back
#define str to_string
#define gcd __gcd
#define optimise cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
using namespace std;
const ll MOD = 998244353;
ll n,m;
char arr[1000][1000];
string ans;
void query(char out,ll&x,ll&y){cout<<out<<endl;fflush(stdout);cin>>x>>y;}
void dfs(ll x,ll y,string path){
    if(arr[x][y]=='F'){ans=path;return;}
    arr[x][y]='*';
    if(x+1<n && arr[x+1][y]!='*')dfs(x+1,y,path+'D');
    if(y+1<m && arr[x][y+1]!='*')dfs(x,y+1,path+'R');
    if(y     && arr[x][y-1]!='*')dfs(x,y-1,path+'L');
    if(x     && arr[x-1][y]!='*')dfs(x-1,y,path+'U');
}
void solve()
{
    cin>>n>>m;
    for(ll i=0;i<n;i++)cin>>arr[i];
    ll nx,ny;
    ll flagH=0,flagV=0,startx=0,starty=0;
    if(arr[0][1]==arr[1][0]){
        ll x,y;query('D',x,y);
        if(x!=y)query('U',nx,ny);
        else flagV=1;
        query('R',x,y);
        if(x!=y)query('L',x,y);
        else flagH=1;
    }
    elif(arr[0][1]=='.'){
        ll x,y;query('R',x,y);
        char pr='R';
        if(x==y)flagH=-1,pr='L';
        x--;y--;
        while(arr[1][y]=='*')y+=1,query(pr,nx,ny);
        ll qx,qy;query('D',qx,qy);
        if(arr[1][y]=='F'){
            if(qx==x+1)query('U',nx,ny);
            return;}
        if(qx!=x+1)query('U',nx,ny);
        else flagV=1;
        startx=x,starty=y;
    }
    else{
        ll x,y;query('D',x,y);
        char pr='D';
        if(x==y)flagV=1,pr='U';
        else query('U',nx,ny);
        x--;y--;
        while(arr[x][1]=='*')x+=1,query(pr,nx,ny);
        ll qx,qy;query('R',qx,qy);
        if(arr[x][1]=='F'){
            if(qy==y+1)query('L',nx,ny);
            return;}
        if(qy!=y+1)query('L',nx,ny);
        else flagH=1;
        startx=x,starty=y;
    }
    dfs(startx,starty,"");
    map<char,char>cntrls={{'U','U'},{'R','R'},{'L','L'},{'D','D'}};
    if(flagH)cntrls['R']='L',cntrls['L']='R';
    if(flagV)cntrls['U']='D',cntrls['D']='U';
    for(auto&i:ans)query(cntrls[i],nx,ny);
}
int main()
{
    optimise
    ll t=1;
    while(t--)solve();
}


#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
#define ll long long
#define elif else if
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define append push_back
#define pb push_back
#define str to_string
#define gcd __gcd
#define optimise cout.tie(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
using namespace std;
const ll MOD = 998244353;
ll n,m;
char arr[1000][1000];
string ans;
void query(char out,ll&x,ll&y){cout<<out<<endl;fflush(stdout);cin>>x>>y;}
void dfs(ll x,ll y,string path){
    if(arr[x][y]=='F'){ans=path;return;}
    arr[x][y]='*';
    if(x+1<n && arr[x+1][y]!='*')dfs(x+1,y,path+'D');
    if(y+1<m && arr[x][y+1]!='*')dfs(x,y+1,path+'R');
    if(y     && arr[x][y-1]!='*')dfs(x,y-1,path+'L');
    if(x     && arr[x-1][y]!='*')dfs(x-1,y,path+'U');
}
void solve()
{
    cin>>n>>m;
    for(ll i=0;i<n;i++)cin>>arr[i];
    ll nx,ny;
    ll flagH=0,flagV=0,startx=0,starty=0;
    if(arr[0][1]==arr[1][0]){
        ll x,y;query('D',x,y);
        if(x!=y)query('U',nx,ny);
        else flagV=1;
        query('R',x,y);
        if(x!=y)query('L',x,y);
        else flagH=1;
    }
    elif(arr[0][1]=='.'){
        ll x,y;query('R',x,y);
        char pr='R';
        if(x==y)flagH=-1,pr='L';
        else query('L',nx,ny);
        x--;y--;
        while(arr[1][y]=='*')y+=1,query(pr,nx,ny);
        ll qx,qy;query('D',qx,qy);
        if(arr[1][y]=='F'){
            if(qx==x+1)query('U',nx,ny);
            return;}
        if(qx!=x+1)query('U',nx,ny);
        else flagV=1;
        startx=x,starty=y;
    }
    else{
        ll x,y;query('D',x,y);
        char pr='D';
        if(x==y)flagV=1,pr='U';
        else query('U',nx,ny);
        x--;y--;
        while(arr[x][1]=='*')x+=1,query(pr,nx,ny);
        ll qx,qy;query('R',qx,qy);
        if(arr[x][1]=='F'){
            if(qy==y+1)query('L',nx,ny);
            return;}
        if(qy!=y+1)query('L',nx,ny);
        else flagH=1;
        startx=x,starty=y;
    }
    dfs(startx,starty,"");
    map<char,char>cntrls={{'U','U'},{'R','R'},{'L','L'},{'D','D'}};
    if(flagH)cntrls['R']='L',cntrls['L']='R';
    if(flagV)cntrls['U']='D',cntrls['D']='U';
    for(auto&i:ans)query(cntrls[i],nx,ny);
}
int main()
{
    optimise
    ll t=1;
    while(t--)solve();
}
/*
10 10
.*********
.*********
..********
*.********
*.********
*F********
**********
**********
**********
**********

 */


#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int gx = 0, gy = 0;
int x = 1, y = 1;

void get(char s){
    cout << s << endl;
    cin >> x >> y;
    if(x == gx && y == gy) exit(0);
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> v(n+2, vector<int>(m+2, 0));
    auto visited = v, val = v;
    for (int i = 0; i <= n+1; ++i) {
        fill(val[i].begin(),val[i].end(), -1);
    }
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < m; ++j) {
            v[i+1][j+1] = s[j] != '*';
            if(s[j] == 'F'){
                gx = i+1, gy = j+1;
            }
        }
    }
    if(n == 1){
        get('R');
        if(y == 1) {
            for (int i = 0; i < m; ++i) {
                get('L');
            }
        }else {
            for (int i = 0; i < m; ++i) {
                get('R');
            }
        }
    }
    if(m == 1){
        get('D');
        if(x == 1) {
            for (int i = 0; i < n; ++i) {
                get('U');
            }
        }else {
            for (int i = 0; i < n; ++i) {
                get('D');
            }
        }
    }
    int revl = 0, revd = 0;
    if(v[1][2]){
        get('L');
        if(y != 1) revl = 1, get('R');
        while(!v[x+1][y]) get(revl ? 'L' : 'R');
        get('U');
        if(x != 1) revd = 1, get('D');
    }else {
        get('U');
        if(x != 1) revd = 1, get('D');
        while(!v[x][y+1]) get(revd ? 'U' : 'D');
        get('L');
        if(y != 1) revd = 1, get('R');
    }
    array<int, 4> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
    string s = "LRUD";
    queue<pair<int, int>> Q;
    visited[x][y] = 1;
    Q.emplace(x, y);
    while(!Q.empty()){
        int i, j; tie(i, j) = Q.front(); Q.pop();
        for (int k = 0; k < 4; ++k) {
            if(!visited[i+dy[k]][j+dx[k]] && v[i+dy[k]][j+dx[k]]){
                visited[i+dy[k]][j+dx[k]] = 1;
                val[i+dy[k]][j+dx[k]] = k;
                Q.emplace(i+dy[k], j+dx[k]);
            }
        }
    }
    string ans;
    while(gy != y || gx != x){
        int k = val[gx][gy];
        k = (k >= 2 ? k^revd : k^revl);
        ans += s[k];
        int vval = val[gx][gy];
        gx -= dy[vval]; gy -= dx[vval];
    }
    reverse(ans.begin(),ans.end());
    for (auto &&i : ans) {
        get(i);
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int gx = 0, gy = 0;
int x = 1, y = 1;

void get(char s){
    cout << s << endl;
    cin >> x >> y;
    if(x == gx && y == gy) exit(0);
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> v(n+2, vector<int>(m+2, 0));
    auto visited = v, val = v;
    for (int i = 0; i <= n+1; ++i) {
        fill(val[i].begin(),val[i].end(), -1);
    }
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < m; ++j) {
            v[i+1][j+1] = s[j] != '*';
            if(s[j] == 'F'){
                gx = i+1, gy = j+1;
            }
        }
    }
    if(n == 1){
        get('R');
        if(y == 1) {
            for (int i = 0; i < m; ++i) {
                get('L');
            }
        }else {
            for (int i = 0; i < m; ++i) {
                get('R');
            }
        }
    }
    if(m == 1){
        get('D');
        if(x == 1) {
            for (int i = 0; i < n; ++i) {
                get('U');
            }
        }else {
            for (int i = 0; i < n; ++i) {
                get('D');
            }
        }
    }
    int revl = 0, revd = 0;
    if(v[1][2]){
        get('L');
        if(y != 1) revl = 1, get('R');
        while(!v[x+1][y]) get(revl ? 'L' : 'R');
        get('U');
        if(x != 1) revd = 1, get('D');
    }else {
        get('U');
        if(x != 1) revd = 1, get('D');
        while(!v[x][y+1]) get(revd ? 'U' : 'D');
        get('L');
        if(y != 1) revl = 1, get('R');
    }
    array<int, 4> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
    string s = "LRUD";
    queue<pair<int, int>> Q;
    visited[x][y] = 1;
    Q.emplace(x, y);
    while(!Q.empty()){
        int i, j; tie(i, j) = Q.front(); Q.pop();
        for (int k = 0; k < 4; ++k) {
            if(!visited[i+dy[k]][j+dx[k]] && v[i+dy[k]][j+dx[k]]){
                visited[i+dy[k]][j+dx[k]] = 1;
                val[i+dy[k]][j+dx[k]] = k;
                Q.emplace(i+dy[k], j+dx[k]);
            }
        }
    }
    string ans;
    while(gy != y || gx != x){
        int k = val[gx][gy];
        k = (k >= 2 ? k^revd : k^revl);
        ans += s[k];
        int vval = val[gx][gy];
        gx -= dy[vval]; gy -= dx[vval];
    }
    reverse(ans.begin(),ans.end());
    for (auto &&i : ans) {
        get(i);
    }
    return 0;
}


#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
ll n,m,flag;
ll posx=-1,posy=-1;
char a[200][200];
ll visited[200][200],done[200][200];
ll px[]={1,-1,0,0};
ll py[]={0,0,-1,1};
ll isvalid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(done[y][x] && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
ll valid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(a[y][x]!='*' && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
void fin(ll u,ll v)
{
	//cout<<u<<" "<<v<<"\n";
	visited[u][v]=1;
	done[u][v]=1;
	if(u==posy && v==posx)
	{
		flag=1;
		return;
	}
	ll i;
	for(i=0;i<4;i++)
		if(valid(u+py[i],v+px[i]))
		{
			fin(u+py[i],v+px[i]);
			if(flag)
				return;
		}
	done[u][v]=0;
}
void print(ll y,ll x,ll swapl,ll swapu)
{
	ll i;
	visited[y][x]=1;
	if(y==posy && x==posx)
		{
			exit(0);
		}

	for(i=0;i<4;i++)
		if(isvalid(y+py[i],x+px[i]))
		{
			if(px[i]==1)
			{
				if(swapl)
					cout<<"L"<<endl;
				else
					cout<<"R"<<endl;
			}
			else if(px[i]==-1)
			{
				if(swapl)
					cout<<"R"<<endl;
				else
					cout<<"L"<<endl;
			}
			else if(py[i]==1)
			{
				if(swapu)
					cout<<"U"<<endl;
				else
					cout<<"D"<<endl;
			}
			else
			{
				if(swapu)
					cout<<"D"<<endl;
				else
					cout<<"U"<<endl;
			}
			cin>>y>>x;
			print(y,x,swapl,swapu);
		}
}
int main()
{
  IOS
  cin>>n>>m;
  ll i,j,x,y;
  for(i=1;i<=n;i++)
  {
  	string s;
  	cin>>s;
  	for(j=1;j<=m;j++)
  	{
  		a[i][j]=s[j-1];
  		if(a[i][j]=='F')
  		{
  			posy=i;
  			posx=j;
  		}
  	}
  }
  ll cnt=2*n*m;
  if(n==1)
  {
	 	cout<<"R"<<endl;
	 	cin>>x>>y;

	 	if(a[x][y]=='F'||x<0)
	 		return 0;

	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"L"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"R"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else if(m==1)
  {
	  	cout<<"D"<<endl;
	  	cin>>x>>y;

	 	if(x<0 || a[x][y]=='F')
	 		return 0;
	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"U"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"D"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else
  {
	  	ll swapl=-1,swapu=-1;
	  	if(a[1][2]!='*')
	  	{
		  		cout<<"R"<<endl;
		  		cin>>x>>y;
		  		if(a[x][y]=='F' || x<0)
		  			return 0;
		  		if(y==1)
		  			swapl=1;
		  		else
		  		{
		  			cout<<"L"<<endl;
		  			cin>>x>>y;
		  			if(a[x][y]=='F')
		  				return 0;
		  			swapl=0;
		  		}
		  		while(a[2][y]=='*')
		  		{
		  			if(swapl)
		  				cout<<"L"<<endl;
		  			else
		  				cout<<"R"<<endl;
		  			cin>>x>>y;
		  			if(x<0 || a[x][y]=='F')
		  				return 0;
		  		}
		  		cout<<"D"<<endl;
		  		cin>>x>>y;
		  		if(x==1)
		  			swapu=1;
		  		else
		  			swapu=0;

		  		flag=0;
		  		memset(visited,0,sizeof(visited));
		  		fin(x,y);

		  		memset(visited,0,sizeof(visited));
		  		print(x,y,swapl,swapu);
	  	}
  	else
  	{
	  		cout<<"D"<<endl;
	  		cin>>x>>y;
	  		if(x<0 || a[x][y]=='F')
	  			return 0;
	  		if(x==1)
	  			swapu=1;
	  		else
	  		{
	  			cout<<"U"<<endl;
	  			cin>>x>>y;
	  			if(a[x][y]=='F')
	  				return 0;
	  			swapu=0;
	  		}
	  		while(a[x][2]=='*')
	  		{
	  			if(swapu)
	  				cout<<"U"<<endl;
	  			else
	  				cout<<"D"<<endl;
	  			cin>>x>>y;
	  			if(x<0 || a[x][y]=='F')
	  				return 0;
	  		}
	  		cout<<"R"<<endl;
	  		cin>>x>>y;
	  		if(y==1)
	  			swapl=1;
	  		else
	  			swapl=0;
	  		memset(visited,0,sizeof(visited));
	  		fin(x,y);
	  		memset(visited,0,sizeof(visited));
	  		print(x,y,swapl,swapu);
  	}
  }
  return 0;
}


#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
ll n,m,flag;
ll posx=-1,posy=-1;
char a[200][200];
ll visited[200][200],done[200][200];
ll px[]={1,-1,0,0};
ll py[]={0,0,-1,1};
ll isvalid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(done[y][x] && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
ll valid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(a[y][x]!='*')
			return 1;
		return 0;
	}
	return 0;
}
void fin(ll u,ll v,ll pary,ll parx)
{
	done[u][v]=1;
	if(u==posy && v==posx)
	{
		flag=1;
		return;
	}
	ll i;
	for(i=0;i<4;i++)
		if(valid(u+py[i],v+px[i]) && !(u+py[i]==pary && v+px[i]==parx))
		{
			fin(u+py[i],v+px[i],u,v);
			if(flag)
				return;
		}
	done[u][v]=0;
}
void print(ll y,ll x,ll swapl,ll swapu)
{
	ll i;
	visited[y][x]=1;
	if(y==posy && x==posx)
		{
			exit(0);
		}

	for(i=0;i<4;i++)
		if(isvalid(y+py[i],x+px[i]))
		{
			if(px[i]==1)
			{
				if(swapl)
					cout<<"L"<<endl;
				else
					cout<<"R"<<endl;
			}
			else if(px[i]==-1)
			{
				if(swapl)
					cout<<"R"<<endl;
				else
					cout<<"L"<<endl;
			}
			else if(py[i]==1)
			{
				if(swapu)
					cout<<"U"<<endl;
				else
					cout<<"D"<<endl;
			}
			else
			{
				if(swapu)
					cout<<"D"<<endl;
				else
					cout<<"U"<<endl;
			}
			cin>>x>>y;
			print(x,y,swapl,swapu);
		}
}
int main()
{
  IOS
  cin>>n>>m;
  ll i,j,x,y;
  for(i=1;i<=n;i++)
  {
  	string s;
  	cin>>s;
  	for(j=1;j<=m;j++)
  	{
  		a[i][j]=s[j-1];
  		if(a[i][j]=='F')
  		{
  			posy=i;
  			posx=j;
  		}
  	}
  }
  ll cnt=2*n*m;
  if(n==1)
  {
	 	cout<<"R"<<endl;
	 	cin>>x>>y;

	 	if(a[x][y]=='F'||x<0)
	 		return 0;

	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"L"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"R"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else if(m==1)
  {
	  	cout<<"D"<<endl;
	  	cin>>x>>y;

	 	if(x<0 || a[x][y]=='F')
	 		return 0;
	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"U"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"D"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else
  {
	  	ll swapl=-1,swapu=-1;
	  	if(a[1][2]!='*')
	  	{
		  		cout<<"R"<<endl;
		  		cin>>x>>y;
		  		if(a[x][y]=='F' || x<0)
		  			return 0;
		  		if(y==1)
		  			swapl=1;
		  		else
		  		{
		  			cout<<"L"<<endl;
		  			cin>>x>>y;
		  			if(a[x][y]=='F')
		  				return 0;
		  			swapl=0;
		  		}
		  		while(a[2][y]=='*')
		  		{
		  			if(swapl)
		  				cout<<"L"<<endl;
		  			else
		  				cout<<"R"<<endl;
		  			cin>>x>>y;
		  			if(x<0 || a[x][y]=='F')
		  				return 0;
		  		}
		  		cout<<"D"<<endl;
		  		cin>>x>>y;
		  		if(x==1)
		  			swapu=1;
		  		else
		  			swapu=0;

		  		flag=0;
		  		memset(visited,0,sizeof(visited));
		  		fin(x,y,0,0);
		  		memset(visited,0,sizeof(visited));
		  		print(x,y,swapl,swapu);
	  	}
  	else
  	{
	  		cout<<"D"<<endl;
	  		cin>>x>>y;
	  		if(x<0 || a[x][y]=='F')
	  			return 0;
	  		if(y==1)
	  			swapu=1;
	  		else
	  		{
	  			cout<<"U"<<endl;
	  			cin>>x>>y;
	  			if(a[x][y]=='F')
	  				return 0;
	  			swapu=0;
	  		}
	  		while(a[x][2]=='*')
	  		{
	  			if(swapu)
	  				cout<<"U"<<endl;
	  			else
	  				cout<<"D"<<endl;
	  			cin>>x>>y;
	  			if(x<0 || a[x][y]=='F')
	  				return 0;
	  		}
	  		cout<<"L"<<endl;
	  		cin>>x>>y;
	  		if(x==1)
	  			swapl=1;
	  		else
	  			swapl=0;
	  		memset(visited,0,sizeof(visited));
	  		fin(x,y,0,0);
	  		memset(visited,0,sizeof(visited));
	  		print(x,y,swapl,swapu);
  	}
  }
  return 0;
}


#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
ll n,m,flag;
ll posx=-1,posy=-1;
char a[200][200];
ll visited[200][200],done[200][200];
ll px[]={1,-1,0,0};
ll py[]={0,0,-1,1};
ll isvalid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(done[y][x] && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
ll valid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(a[y][x]!='*' && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
void fin(ll u,ll v)
{
	//cout<<u<<" "<<v<<"\n";
	visited[u][v]=1;
	done[u][v]=1;
	if(u==posy && v==posx)
	{
		flag=1;
		return;
	}
	ll i;
	for(i=0;i<4;i++)
		if(valid(u+py[i],v+px[i]))
		{
			fin(u+py[i],v+px[i]);
			if(flag)
				return;
		}
	done[u][v]=0;
}
void print(ll y,ll x,ll swapl,ll swapu)
{
	ll i;
	visited[y][x]=1;
	if(y==posy && x==posx)
		{
			exit(0);
		}

	for(i=0;i<4;i++)
		if(isvalid(y+py[i],x+px[i]))
		{
			if(px[i]==1)
			{
				if(swapl)
					cout<<"L"<<endl;
				else
					cout<<"R"<<endl;
			}
			else if(px[i]==-1)
			{
				if(swapl)
					cout<<"R"<<endl;
				else
					cout<<"L"<<endl;
			}
			else if(py[i]==1)
			{
				if(swapu)
					cout<<"U"<<endl;
				else
					cout<<"D"<<endl;
			}
			else
			{
				if(swapu)
					cout<<"D"<<endl;
				else
					cout<<"U"<<endl;
			}
			cin>>y>>x;
			print(y,x,swapl,swapu);
		}
}
int main()
{
  IOS
  cin>>n>>m;
  ll i,j,x,y;
  for(i=1;i<=n;i++)
  {
  	string s;
  	cin>>s;
  	for(j=1;j<=m;j++)
  	{
  		a[i][j]=s[j-1];
  		if(a[i][j]=='F')
  		{
  			posy=i;
  			posx=j;
  		}
  	}
  }
  ll cnt=2*n*m;
  if(n==1)
  {
	 	cout<<"R"<<endl;
	 	cin>>x>>y;

	 	if(a[x][y]=='F'||x<0)
	 		return 0;

	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"L"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"R"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else if(m==1)
  {
	  	cout<<"D"<<endl;
	  	cin>>x>>y;

	 	if(x<0 || a[x][y]=='F')
	 		return 0;
	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"U"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"D"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else
  {
	  	ll swapl=-1,swapu=-1;
	  	if(a[1][2]!='*')
	  	{
		  		cout<<"R"<<endl;
		  		cin>>x>>y;
		  		if(a[x][y]=='F' || x<0)
		  			return 0;
		  		if(y==1)
		  			swapl=1;
		  		else
		  		{
		  			cout<<"L"<<endl;
		  			cin>>x>>y;
		  			if(a[x][y]=='F')
		  				return 0;
		  			swapl=0;
		  		}
		  		while(a[2][y]=='*')
		  		{
		  			if(swapl)
		  				cout<<"L"<<endl;
		  			else
		  				cout<<"R"<<endl;
		  			cin>>x>>y;
		  			if(x<0 || a[x][y]=='F')
		  				return 0;
		  		}
		  		cout<<"D"<<endl;
		  		cin>>x>>y;
		  		if(x==1)
		  			swapu=1;
		  		else
		  			swapu=0;

		  		flag=0;
		  		memset(visited,0,sizeof(visited));
		  		fin(x,y);

		  		memset(visited,0,sizeof(visited));
		  		print(x,y,swapl,swapu);
	  	}
  	else
  	{
	  		cout<<"D"<<endl;
	  		cin>>x>>y;
	  		if(x<0 || a[x][y]=='F')
	  			return 0;
	  		if(y==1)
	  			swapu=1;
	  		else
	  		{
	  			cout<<"U"<<endl;
	  			cin>>x>>y;
	  			if(a[x][y]=='F')
	  				return 0;
	  			swapu=0;
	  		}
	  		while(a[x][2]=='*')
	  		{
	  			if(swapu)
	  				cout<<"U"<<endl;
	  			else
	  				cout<<"D"<<endl;
	  			cin>>x>>y;
	  			if(x<0 || a[x][y]=='F')
	  				return 0;
	  		}
	  		cout<<"L"<<endl;
	  		cin>>x>>y;
	  		if(x==1)
	  			swapl=1;
	  		else
	  			swapl=0;
	  		memset(visited,0,sizeof(visited));
	  		fin(x,y);
	  		memset(visited,0,sizeof(visited));
	  		print(x,y,swapl,swapu);
  	}
  }
  return 0;
}


#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
ll n,m,flag;
ll posx=-1,posy=-1;
char a[200][200];
ll visited[200][200],done[200][200];
ll px[]={1,-1,0,0};
ll py[]={0,0,-1,1};
ll isvalid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(done[y][x] && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
ll valid(ll y,ll x)
{
	if(y>=1 && y<=n && x>=1 && x<=m )
	{
		if(a[y][x]!='*' && !visited[y][x])
			return 1;
		return 0;
	}
	return 0;
}
void fin(ll u,ll v)
{
	//cout<<u<<" "<<v<<"\n";
	visited[u][v]=1;
	done[u][v]=1;
	if(u==posy && v==posx)
	{
		flag=1;
		return;
	}
	ll i;
	for(i=0;i<4;i++)
		if(valid(u+py[i],v+px[i]))
		{
			fin(u+py[i],v+px[i]);
			if(flag)
				return;
		}
	done[u][v]=0;
}
void print(ll y,ll x,ll swapl,ll swapu)
{
	ll i;
	visited[y][x]=1;
	if(y==posy && x==posx)
		{
			exit(0);
		}

	for(i=0;i<4;i++)
		if(isvalid(y+py[i],x+px[i]))
		{
			if(px[i]==1)
			{
				if(swapl)
					cout<<"L"<<endl;
				else
					cout<<"R"<<endl;
			}
			else if(px[i]==-1)
			{
				if(swapl)
					cout<<"R"<<endl;
				else
					cout<<"L"<<endl;
			}
			else if(py[i]==1)
			{
				if(swapu)
					cout<<"U"<<endl;
				else
					cout<<"D"<<endl;
			}
			else
			{
				if(swapu)
					cout<<"D"<<endl;
				else
					cout<<"U"<<endl;
			}
			cin>>y>>x;
			print(y,x,swapl,swapu);
		}
}
int main()
{
  IOS
  cin>>n>>m;
  ll i,j,x,y;
  for(i=1;i<=n;i++)
  {
  	string s;
  	cin>>s;
  	for(j=1;j<=m;j++)
  	{
  		a[i][j]=s[j-1];
  		if(a[i][j]=='F')
  		{
  			posy=i;
  			posx=j;
  		}
  	}
  }
  ll cnt=2*n*m;
  if(n==1)
  {
	 	cout<<"R"<<endl;
	 	cin>>x>>y;

	 	if(a[x][y]=='F'||x<0)
	 		return 0;

	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"L"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"R"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else if(m==1)
  {
	  	cout<<"D"<<endl;
	  	cin>>x>>y;

	 	if(x<0 || a[x][y]=='F')
	 		return 0;
	 	if(y==1)
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"U"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
	 	else
	 	{
	 		while(a[x][y]!='F')
	 		{
	 			cout<<"D"<<endl;
	 			cin>>x>>y;
	 			if(x<0)
	 				return 0;
	 		}
	 	}
  }
  else
  {
	  	ll swapl=-1,swapu=-1;
	  	if(a[1][2]!='*')
	  	{
		  		cout<<"R"<<endl;
		  		cin>>x>>y;
		  		if(a[x][y]=='F' || x<0)
		  			return 0;
		  		if(y==1)
		  			swapl=1;
		  		else
		  		{
		  			cout<<"L"<<endl;
		  			cin>>x>>y;
		  			if(a[x][y]=='F')
		  				return 0;
		  			swapl=0;
		  		}
		  		while(a[2][y]=='*')
		  		{
		  			if(swapl)
		  				cout<<"L"<<endl;
		  			else
		  				cout<<"R"<<endl;
		  			cin>>x>>y;
		  			if(x<0 || a[x][y]=='F')
		  				return 0;
		  		}
		  		cout<<"D"<<endl;
		  		cin>>x>>y;
		  		if(x==1)
		  			swapu=1;
		  		else
		  			swapu=0;

		  		flag=0;
		  		memset(visited,0,sizeof(visited));
		  		fin(x,y);

		  		memset(visited,0,sizeof(visited));
		  		print(x,y,swapl,swapu);
	  	}
  	else
  	{
	  		cout<<"D"<<endl;
	  		cin>>x>>y;
	  		if(x<0 || a[x][y]=='F')
	  			return 0;
	  		if(x==1)
	  			swapu=1;
	  		else
	  		{
	  			cout<<"U"<<endl;
	  			cin>>x>>y;
	  			if(a[x][y]=='F')
	  				return 0;
	  			swapu=0;
	  		}
	  		while(a[x][2]=='*')
	  		{
	  			if(swapu)
	  				cout<<"U"<<endl;
	  			else
	  				cout<<"D"<<endl;
	  			cin>>x>>y;
	  			if(x<0 || a[x][y]=='F')
	  				return 0;
	  		}
	  		cout<<"L"<<endl;
	  		cin>>x>>y;
	  		if(x==1)
	  			swapl=1;
	  		else
	  			swapl=0;
	  		memset(visited,0,sizeof(visited));
	  		fin(x,y);
	  		memset(visited,0,sizeof(visited));
	  		print(x,y,swapl,swapu);
  	}
  }
  return 0;
}