/+ dub.sdl:
    name "B"
    dependency "dcomp" version=">=0.6.0"
+/

import std.stdio, std.algorithm, std.range, std.conv;
// import dcomp.foundation, dcomp.scanner;

// import dcomp.graph.mincostflow;

int main() {
    Scanner sc = new Scanner(stdin);
    int n;
    int[] u, d, l, r;
    sc.read(n, u, d, l, r);

    struct E { int to, cap, dist; int rev; }
 
    E[][] g = new E[][n*n+4*n + 2];
    void add(int from, int to, int cap, int dist) {
//        writeln("add ", from, " ", to, " ", cap);
        g[from] ~= E(to, cap, dist, g[to].length.to!int);
        g[to] ~= E(from, 0, -dist, g[from].length.to!int-1);
    }
    int off = n*n;
    int sv = off + 4*n, tv = sv + 1;

    int id(int x, int y) {
        return y * n + x;
    }
    foreach (i; 0..n*n) {
        add(i, tv, 1, 0);
    }

    foreach (i; 0..n) {
        add(sv, off + i, u[i], 0);
        add(sv, off + n + i, d[i], 0);
        foreach (j; 0..n) {
            add(off + i, id(i, j), 1, j);
        }
        foreach (j; 0..n) {
            add(off + n + i, id(i, n-1-j), 1, j);
        }
    }

    foreach (i; 0..n) {
        add(sv, off + 2*n + i, l[i], 0);
        add(sv, off + 3*n + i, r[i], 0);
        foreach (j; 0..n) {
            add(off + 2*n + i, id(j, i), 1, j);
        }
        foreach (j; 0..n) {
            add(off + 3*n + i, id(n-1-j, i), 1, j);
        }
    }

    auto mcf = minCostFlow!(int, int)(g, sv, tv, false);

    mcf.manyFlow(n*n);
//    writeln(mcf.capFlow);

    if (mcf.capFlow != n*n) {
        writeln("NO");
        return 0;
    }
    
    int[][] buf = new int[][4*n];
    foreach (i; 0..n) {
        foreach (j; 0..n) {
            int k = id(i, j);
            foreach (e; g[k]) {
                if (e.to >= sv) continue;
                if (e.cap == 0) continue;
//                writeln(k, " -> ", e.to);
                buf[e.to - off] ~= k;
            }
        }
    }
    foreach (i; 0..n) buf[i].sort!"a>b";
    foreach (i; n..2*n) buf[i].sort!"a<b";
    foreach (i; 2*n..3*n) buf[i].sort!"a>b";
    foreach (i; 3*n..4*n) buf[i].sort!"a<b";
    
//    writeln(buf);
    bool[] used = new bool[off];
    while (true) {
        bool check(T)(ref int[] v, T rng) {
            if (!v.length) return false;
            int d = v[$-1];
            foreach (x; rng) {
                if (x == d) {
                    v = v[0..$-1];
                    used[x] = true;
                    return true;
                }
                if (!used[x]) break;
            }
            return false;
        }
        bool update = false;
        foreach (i; 0..n) {
            int j = i%n;
            if(check(buf[i], iota(0+j, off+j, n))) {
                update = true;
                writeln("U", j+1);
            }
        }
        foreach (i; n..2*n) {
            int j = i%n;
            if(check(buf[i], iota(0+j, off+j, n).retro)) {
                update = true;
                writeln("D", j+1);
            }
        }
        foreach (i; 2*n..3*n) {
            int j = i%n;
            if(check(buf[i], iota(j*n, (j+1)*n))) {
                update = true;
                writeln("L", j+1);
            }
        }
        foreach (i; 3*n..4*n) {
            int j = i%n;
            if(check(buf[i], iota(j*n, (j+1)*n).retro)) {
                update = true;
                writeln("R", j+1);
            }
        }
        if (!update) break;
    }

    return 0;
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/container/radixheap.d */
// module dcomp.container.radixheap;

// import dcomp.foundation;
// import dcomp.array;


import std.functional : unaryFun;
import std.traits : isSigned, isUnsigned;

template RadixHeap(T, alias _pred = "a")
if (isSigned!(typeof(unaryFun!_pred(T())))) {
    import std.traits : Unsigned;
    alias pred = unaryFun!_pred;
    alias S = typeof(pred(T()));
    alias U = Unsigned!S;
    U pred2(in T x) {
        return pred(x) ^ (U(1) << (U.sizeof*8-1));
    }
    alias RadixHeap = RadixHeap!(T, pred2);
}

import core.bitop;

struct RadixHeap(T, alias _pred = "a")
if (isUnsigned!(typeof(unaryFun!_pred(T())))) {
    import std.algorithm;
    import core.exception : RangeError;
    alias pred = unaryFun!_pred;
    alias U = typeof(pred(T()));
    static int bsr1(U x) {
        return (x == 0) ? 0 : bsr(x)+1;
    }
    static struct Payload {
        FastAppender!(T[])[U.sizeof*8+1] v;
        size_t length;
        U last;
        void insert(T p) {
            U x = pred(p);
            assert(last <= x);
            length++;
            v[bsr1(x^last)] ~= p;
        }
        bool empty() const {
            return length == 0;
        }
        T front() {
            if (!v[0].length) {
                int i = 1;
                while (!v[i].length) i++;
                last = v[i].data[].map!pred.fold!"min(a, b)";
                foreach (T p; v[i].data) {
                    v[bsr1(pred(p)^last)] ~= p;
                }
                v[i].clear();
            }
            return v[0].data[$-1];
        }
        void removeFront() {
            front();
            length--;
            v[0].removeBack();
        }        
    }
    Payload* p;
    private void I() { if (!p) p = new Payload(); }
    private void C() const {
        version(assert) if (!p) throw new RangeError();
    }
    void insert(T x) {I; p.insert(x); }
    @property bool empty() const { return (p == null || p.empty); }
    @property size_t length() const { return (p ? p.length : 0); }
    T front() {C; return p.front; }
    void removeFront() {I; p.removeFront(); }
}

 

 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/graph/mincostflow.d */
// module dcomp.graph.mincostflow;

// import dcomp.container.deque;

import std.stdio;

struct MinCostFlowInfo(C, D, T) {
    T g; int s, t;
    C nc, capFlow;
    D nd, flow;
    D[] dual;  
    int[] pv, pe;  
    this(T g, int s, int t) {
        this.g = g;
        this.s = s;
        this.t = t;
        dual = new D[g.length];
        pv = new int[g.length];
        pe = new int[g.length];
    }
}

 
MinCostFlowInfo!(C, D, T) minCostFlow(C, D, T)(T g, int s, int t, bool neg) {
    assert(s != t);
    import std.algorithm : map;
    import std.range : array;
    import std.conv : to;
    auto mcfInfo = MinCostFlowInfo!(C, D, T)(g, s, t);
    mcfInfo.dualRef(neg);
    return mcfInfo;
}

 
 


 

C singleFlow(C, D, T)(ref MinCostFlowInfo!(C, D, T) mcfInfo, C c) {
    import std.algorithm;
    with (mcfInfo) {
        if (nd == D.max) return nc;
        c = min(c, nc);
        for (int v = t; v != s; v = pv[v]) {
            g[pv[v]][pe[v]].cap -= c;
            g[v][g[pv[v]][pe[v]].rev].cap += c;
        }
        capFlow += c;
        flow += c * nd;
        nc -= c;
        if (!nc) dualRef(mcfInfo, false);
    }
    return c;
}

void manyFlow(C, D, T)(ref MinCostFlowInfo!(C, D, T) mcfInfo, C c) {
    with (mcfInfo) {
        while (c) {
            C f = singleFlow(mcfInfo, c);
            if (!f) break;
            c -= f;
        }
    }
}

// import dcomp.array;
// import dcomp.container.radixheap;

void dualRef(bool neg, C, D, T)(ref MinCostFlowInfo!(C, D, T) mcfInfo) {
    import std.conv : to;
    import std.traits : isIntegral;
    import std.typecons;
    import std.container;
    import std.algorithm;
    alias P = Tuple!(int, "to", D, "dist");

    with(mcfInfo) {
        int n = g.length.to!int;
        D[] dist = new D[n]; dist[] = D.max;
        pv[] = -1; pe[] = -1;
        FastAppender!(int[]) refV;
        auto que = (){
            static if (!neg) {
                static if (isIntegral!D) {
                    return RadixHeap!(P, "a.dist")();
                } else {
                    return heapify!"a.dist>b.dist"(make!(Array!P));
                }
            } else {
                return Deque!P();
            }
        }();
        void insert(P p) {
            static if (!neg) {
                que.insert(p);
            } else {
                que.insertBack(p);
            }
        }
        P pop() {
            P p;
            static if (!neg) {
                p = que.front();
                que.removeFront();
            } else {
                p = que.back();
                que.removeBack();
            }
            return p;
        }
        insert(P(s, 0));
        dist[s] = 0;
        while (!que.empty) {
            P p = pop();
            int v = p.to;
            if (dist[v] < p.dist) continue;
            if (!neg) {
                if (v == t) break;
                refV ~= v;
            }
            foreach (int i, e; g[v]) {
                D ed = e.dist + dual[v] - dual[e.to];
                if (e.cap && dist[e.to] > dist[v] + ed) {
                    dist[e.to] = dist[v] + ed;
                    pv[e.to] = v; pe[e.to] = i;
                    insert(P(e.to, dist[e.to]));
                }
            }
        }
        if (dist[t] == D.max) {
            nd = D.max;
            nc = 0;
            return;
        }
        static if (!neg) {
            foreach (v; refV.data) {
                if (dist[v] >= dist[t]) continue;
                dual[v] += dist[v]-dist[t];
            }
        } else {
            for (int v = 0; v < n; v++) {
                if (dist[v] == D.max) dual[v] = D.max;
                else dual[v] += dist[v];
            }
        }
        
        nd = dual[t]-dual[s];
        nc = C.max;
        for (int v = t; v != s; v = pv[v]) {
            nc = min(nc, g[pv[v]][pe[v]].cap);
        }
    }
}

void dualRef(C, D, T)(ref MinCostFlowInfo!(C, D, T) mcfInfo, bool neg) {
    if (neg == false) {
        dualRef!false(mcfInfo);
    } else {
        dualRef!true(mcfInfo);
    }
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/container/deque.d */
// module dcomp.container.deque;

struct DequePayload(T) {
    import core.exception : RangeError;
    import core.memory : GC;
    import std.range : ElementType, isInputRange;
    import std.traits : isImplicitlyConvertible;
    T *d;
    size_t st, length, cap;
    @property bool empty() const { return length == 0; }
    alias opDollar = length;
    ref inout(T) opIndex(size_t i) inout {
        version(assert) if (length <= i) throw new RangeError();
        return d[(st+i >= cap) ? (st+i-cap) : st+i];
    }
    private void expand() {
        import std.algorithm : max;
        assert(length == cap);
        auto nc = max(size_t(4), 2*cap);
        T* nd = cast(T*)GC.malloc(nc * T.sizeof);
        foreach (i; 0..length) {
            nd[i] = this[i];
        }
        d = nd; st = 0; cap = nc;
    }
    void clear() {
        st = length = 0;
    }
    void insertFront(T v) {
        if (length == cap) expand();
        if (st == 0) st += cap;
        st--; length++;
        this[0] = v; 
    }
    void insertBack(T v) {
        if (length == cap) expand();
        length++;
        this[length-1] = v; 
    }
    void removeFront() {
        assert(!empty, "Deque.removeFront: Deque is empty");        
        st++; length--;
        if (st == cap) st = 0;
    }
    void removeBack() {
        assert(!empty, "Deque.removeBack: Deque is empty");        
        length--;
    }
    
    ref inout(T) front() inout { return this[0]; }
    ref inout(T) back() inout { return this[$-1]; }
    Range opSlice() {return Range(&this, 0, length); }
    
    alias Range = RangeT!(DequePayload!T);
    alias ConstRange = RangeT!(const DequePayload!T);
    alias ImmutableRange = RangeT!(immutable DequePayload!T);

    static struct RangeT(A) {
        import std.traits : CopyTypeQualifiers;
        alias E = CopyTypeQualifiers!(A, T);
        A *p;
        size_t a, b;
        @property bool empty() const { return b <= a; }
        @property size_t length() const { return b-a; }
        @property RangeT save() { return RangeT(p, a, b); }
        @property RangeT!(const A) save() const {
            return typeof(return)(p, a, b);
        }
        alias opDollar = length;
        @property ref inout(E) front() inout { return (*p)[a]; }
        @property ref inout(E) back() inout { return (*p)[b-1]; }
        void popFront() {
            version(assert) if (empty) throw new RangeError();
            a++;
        }
        void popBack() {
            version(assert) if (empty) throw new RangeError();
            b--;
        }
        ref inout(E) opIndex(size_t i) inout { return (*p)[i]; }
        RangeT opSlice() { return this.save; }
        RangeT opSlice(size_t i, size_t j) {
            version(assert) if (i > j || a + j > b) throw new RangeError();
            return typeof(return)(p, a+i, a+j);
        }
        RangeT!(const A) opSlice() const { return this.save; }
        RangeT!(const A) opSlice(size_t i, size_t j) const {
            version(assert) if (i > j || a + j > b) throw new RangeError();
            return typeof(return)(p, a+i, a+j);
        }
    }
}


 
struct Deque(T, bool mayNull = true) {
    import core.exception : RangeError;
    import core.memory : GC;
    import std.range : ElementType, isInputRange;
    import std.traits : isImplicitlyConvertible;

    alias Payload = DequePayload!T;
    alias Range = Payload.Range;
    alias ConstRange = Payload.ConstRange;
    alias ImmutableRange = Payload.ImmutableRange;
    
    Payload* p;
    private void I() { if (mayNull && !p) p = new Payload(); }
    private void C() const {
        version(assert) if (mayNull && !p) throw new RangeError();
    }
    static if (!mayNull) {
        @disable this();
    }
     
    private this(Payload* p) {
        this.p = p;
    }
    this(U)(U[] values...) if (isImplicitlyConvertible!(U, T)) {
        p = new Payload();
        foreach (v; values) {
            insertBack(v);
        }
    }
     
    this(Range)(Range r)
    if (isInputRange!Range &&
    isImplicitlyConvertible!(ElementType!Range, T) &&
    !is(Range == T[])) {
        p = new Payload();
        foreach (v; r) {
            insertBack(v);
        }
    }
    static Deque make() { return Deque(new Payload()); }
    @property bool havePayload() const { return (!mayNull || p); }
     
    @property bool empty() const { return (!havePayload || p.empty); }
     
    @property size_t length() const { return (havePayload ? p.length : 0); }
     
    alias opDollar = length;
    ref inout(T) opIndex(size_t i) inout {C; return (*p)[i]; }
     
    ref inout(T) front() inout {C; return (*p)[0]; }
     
    ref inout(T) back() inout {C; return (*p)[$-1]; }
    void clear() { if (p) p.clear(); }
     
    void insertFront(T v) {I; p.insertFront(v); }
     
    void insertBack(T v) {I; p.insertBack(v); }
     
    alias stableInsertBack = insertBack;
     
    void removeFront() {C; p.removeFront(); }
     
    void removeBack() {C; p.removeBack(); }
     
    Range opSlice() {I; return Range(p, 0, length); }
}


 

 

 

 

 

 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/scanner.d */
// module dcomp.scanner;

 
class Scanner {
    import std.stdio : File;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeChar, isStaticArray, isArray; 
    import std.algorithm : map;
    File f;
    this(File f) {
        this.f = f;
    }
    char[512] lineBuf;
    char[] line;
    private bool succ() {
        import std.range.primitives : empty, front, popFront;
        import std.ascii : isWhite;
        while (true) {
            while (!line.empty && line.front.isWhite) {
                line.popFront;
            }
            if (!line.empty) break;
            if (f.eof) return false;
            line = lineBuf[];
            f.readln(line);
        }
        return true;
    }

    private bool readSingle(T)(ref T x) {
        import std.algorithm : findSplitBefore;
        import std.string : strip;
        import std.conv : parse;
        if (!succ()) return false;
        static if (isArray!T) {
            alias E = ElementType!T;
            static if (isSomeChar!E) {
                 
                 
                auto r = line.findSplitBefore(" ");
                x = r[0].strip.dup;
                line = r[1];
            } else {
                auto buf = line.split.map!(to!E).array;
                static if (isStaticArray!T) {
                     
                    assert(buf.length == T.length);
                }
                x = buf;
                line.length = 0;
            }
        } else {
            x = line.parse!T;
        }
        return true;
    }
    int read(T, Args...)(ref T x, auto ref Args args) {
        if (!readSingle(x)) return 0;
        static if (args.length == 0) {
            return 1;
        } else {
            return 1 + read(args);
        }
    }
}


 
 

 
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/foundation.d */
// module dcomp.foundation;
 
static if (__VERSION__ <= 2070) {
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            import std.algorithm : reduce;
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                import std.typecons : tuple;
                return reduce!fun(tuple(seed), r);
            }
        }
    }
     
}
version (X86) static if (__VERSION__ < 2071) {
    import core.bitop : bsf, bsr, popcnt;
    int bsf(ulong v) {
        foreach (i; 0..64) {
            if (v & (1UL << i)) return i;
        }
        return -1;
    }
    int bsr(ulong v) {
        foreach_reverse (i; 0..64) {
            if (v & (1UL << i)) return i;
        }
        return -1;   
    }
    int popcnt(ulong v) {
        int c = 0;
        foreach (i; 0..64) {
            if (v & (1UL << i)) c++;
        }
        return c;
    }
}
/* IMPORT /home/yosupo/Program/dcomp/source/dcomp/array.d */
// module dcomp.array;

 
T[N] fixed(T, size_t N)(T[N] a) {return a;}

 
 

 
 
struct FastAppender(A) {
    import std.algorithm : max;
    import std.range.primitives : ElementEncodingType;
    import core.stdc.string : memcpy;

    private alias T = ElementEncodingType!A;
    private T* _data;
    private size_t len, cap;
     
    @property size_t length() {return len;}
     
    void reserve(size_t nlen) {
        import core.memory : GC;
        if (nlen <= cap) return;
        
        void* nx = GC.malloc(nlen * T.sizeof);

        cap = nlen;
        if (len) memcpy(nx, _data, len * T.sizeof);
        _data = cast(T*)(nx);
    }
     
    void opOpAssign(string op : "~")(T item) {
        if (len == cap) {
            reserve(max(4, cap*2));
        }
        _data[len++] = item;
    }
    void removeBack() {
        len--;
    }
     
    void clear() {
        len = 0;
    }
     
    T[] data() {
        return (_data) ? _data[0..len] : null;
    }
}

 
