/*--------------------------------------------------------------*/
/* ACM ICPC 2009-2010, NEERC                                    */
/* Northern Subregional Contest                                 */
/* St Petersburg, October 17, 2009                              */
/*--------------------------------------------------------------*/
/* Problem I. Image Recognition                                 */
/*                                                              */
/* Original idea         Mikhail Dvorkin                        */
/* Problem statement     Mikhail Dvorkin                        */
/* Testset               Mikhail Dvorkin                        */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Andrew Stankevich                      */
/*--------------------------------------------------------------*/
 
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import static java.lang.Math.abs;
import static java.lang.Math.max;
import java.util.Arrays;
import java.util.Scanner;

class image_as implements Runnable {
    int[][][] memo;
    int[][][] gox;
    int[][][] goy;
    int h;
    int w;
    int n;
    boolean[][][] d;

    PrintWriter out;

    int search(int x, int y, int mask, int sz) {
        if (sz == 1) {
            return 0;
        }
        if (memo[x][y][mask] != -1) {
            return memo[x][y][mask];
        }

        memo[x][y][mask] = Integer.MAX_VALUE;
        for (int nx = 0; nx < h; nx++) {
            for (int ny = 0; ny < w; ny++) {
                int go = abs(x - nx) + abs(y - ny);
                int masktrue = 0;
                int maskfalse = 0;
                int sztrue = 0;
                int szfalse = 0;
                for (int j = 0; j < n; j++) {
                    if ((mask & (1 << j)) != 0) {
                        if (d[j][nx][ny]) {
                            masktrue |= (1 << j);
                            sztrue++;
                        } else {
                            maskfalse |= (1 << j);
                            szfalse++;
                        }
                    }
                }
                if (masktrue == 0 || maskfalse == 0) {
                    continue;
                }
                int t = max(search(nx, ny, masktrue, sztrue), search(nx, ny, maskfalse, szfalse));
                if (go + t < memo[x][y][mask]) {
                    memo[x][y][mask] = go + t;
                    gox[x][y][mask] = nx;
                    goy[x][y][mask] = ny;
                }
            }
        }
        return memo[x][y][mask];
    }

    void print(int x, int y, int mask, int sz) {
        if (sz == 1) {
            for (int j = 0; j < n; j++) {
                if ((mask & (1 << j)) != 0) {
                    out.print(j);
                }
            }
            return;
        }
        int nx = gox[x][y][mask];
        int ny = goy[x][y][mask];
        while (x > nx) {
            out.print("U");
            x--;
        }
        while (x < nx) {
            out.print("D");
            x++;
        }
        while (y > ny) {
            out.print("L");
            y--;
        }
        while (y < ny) {
            out.print("R");
            y++;
        }
        int masktrue = 0;
        int maskfalse = 0;
        int sztrue = 0;
        int szfalse = 0;
        for (int j = 0; j < n; j++) {
            if ((mask & (1 << j)) != 0) {
                if (d[j][nx][ny]) {
                    masktrue |= (1 << j);
                    sztrue++;
                } else {
                    maskfalse |= (1 << j);
                    szfalse++;
                }
            }
        }
        out.print("(");
        print(nx, ny, masktrue, sztrue);
        out.print(":");
        print(nx, ny, maskfalse, szfalse);
        out.print(")");
    }

    public void solve() throws IOException {
        Scanner in = new Scanner(System.in);
        out = new PrintWriter(System.out);

        n = in.nextInt();
        h = in.nextInt();
        w = in.nextInt();

        d = new boolean[n][h][w];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < h; j++) {
                String s = in.next();
                for (int k = 0; k < w; k++) {
                    d[i][j][k] = s.charAt(k) == 'W';
                }
            }
        }

        memo = new int[h][w][1 << n];
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                Arrays.fill(memo[i][j], -1);
            }
        }
        gox = new int[h][w][1 << n];
        goy = new int[h][w][1 << n];
        search(0, 0, (1 << n) - 1, n);
        print(0, 0, (1 << n) - 1, n);

        in.close();
        out.close();
    }

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
            throw new AssertionError();
        }
    }

    public static void main(String[] args) {
        new Thread(new image_as()).start();
    }
}
