#include<bits/stdc++.h>
using namespace std;
class ExplodingRobots
{
public:
    string canExplode(int x1, int y1, int x2, int y2, string a)
    {
        int u=0,r=0,d=0,l=0,i,len=a.length();
        for(i=0;i<len;i++)
        {
            if(a[i]=='U') u++;
            else if(a[i]=='L') l++;
            else if(a[i]=='D') d++;
            else r++;
        }
        if(x2>x1)
        {
            if(x2-l>x1+r) return "Safe";
            if(y2>y1)
            {
                if(y2-d>y1+u) return "Safe";
                return "Explosion";
            }
            else
            {
                if(y2+u<y1-d) return "Safe";
                return "Explosion";
            }
        }
        else
        {
            if(x1-l>x2+r) return "Safe";
            if(y2>y1)
            {
                if(y2-d>y1+u) return "Safe";
                return "Explosion";
            }
            else
            {
                if(y2+u<y1-d) return "Safe";
                return "Explosion";
            }
        }
    }
};
