#include <bits/stdc++.h>   using namespace std;   const long long INF = 2000000000000000000LL;   const int inf = 0x3f3f3f3f;   const long double EPS = 1e-9;   int dirx[] = {0, 0, -1, 1};   int diry[] = {-1, 1, 0, 0};   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     int test;     cin >> test;     while (test--) {       int len;       string path;       cin >> len >> path;       std::map<pair<long long, long long>, int> visit;       long long mn = INF;       pair<long long, long long> mnpath{-1, -1}, pos{0, 0};       visit[{0, 0}] = 0;       for (int i = 0; i < len; i++) {         if (path[i] ==  L )           pos.first += dirx[0], pos.second += diry[0];         else if (path[i] ==  R )           pos.first += dirx[1], pos.second += diry[1];         else if (path[i] ==  U )           pos.first += dirx[2], pos.second += diry[2];         else if (path[i] ==  D )           pos.first += dirx[3], pos.second += diry[3];         if (visit.find(pos) != visit.end()) {           int dis = i - visit[pos] + 1;           if (mn >= dis) {             mn = dis;             mnpath = {visit[pos] + 1, i + 1};           }         }         visit[pos] = i + 1;       }       if (mn != INF)         cout << mnpath.first <<     << mnpath.second << endl;       else         cout << -1 << endl;     }     return 0;   }   