#include <iostream>
#include <cstring>
#include <algorithm>
#define INF 0x3f3f3f3f
#define lowbit(x) -x&x
using namespace std;
typedef long long LL;
const int N = 1e5 + 10, mo = 100000007;
int main(){
int T;
scanf("%d", &T);
while (T -- ){
int l, r, x;
scanf("%d%d%d", &l, &r, &x);
l = (l - 1) / x + 1, r = r / x;
if (r - l >= 1)
printf("%d %d\n", l * x, (l + 1) * x);
else
puts("-1");
}
return 0;
}
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define lowbit(x) -x&x
using namespace std;
typedef long long LL;
const int N = 2010, mo = 100000007;
int dist[N][N];
char g[N][N];
int n, m;
bool st[N][N];
int dx[] = {0, -1, 0, 1}, dy[] = {-1, 0, 1, 0};
struct node{
int x, y;
};
int spfa(){
memset(dist, 0x3f, sizeof dist);
queue<node> q;
q.push({0, 0});
st[0][0] = true;
dist[0][0] = 0;
while (!q.empty()){
auto t = q.front();
q.pop();
for (int i = 0; i < 4; i ++ ){
int nx = t.x + dx[i];
int ny = t.y + dy[i];
int add;
if (g[nx][ny] == '*') add = 0;
else add = 1;
if (g[nx][ny] == '#') continue;
if (nx < 0 || nx >= n || ny < 0 || ny >= m) continue;
if (dist[nx][ny] > dist[t.x][t.y] + add){
dist[nx][ny] = dist[t.x][t.y] + add;
q.push({nx, ny});
}
}
}
if (dist[n-1][m-1] != 0x3f3f3f3f) return dist[n-1][m-1];
else return -1;
}
int main(){
cin >> n >> m;
for (int i = 0; i < n; i ++ )
cin >> g[i];
cout << spfa() << endl;
return 0;
}
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define lowbit(x) -x&x
using namespace std;
typedef long long LL;
const int N = 1e5 + 10, mo = 100000007;
unordered_map<LL, int> st;
vector<int> ans;
int n;
LL x, a;
int main(){
int T;
scanf("%d", &T);
while (T -- ){
st.clear();
ans.clear();
bool flag = true;
cin >> n >> x;
for (int i = 1; i <= n; i ++ ){
cin >> a;
if (!st[a]) st[a] = i;
}
a = 1;
while (x){
if (x & 1){
if (!st[a]) flag = false;
else ans.push_back(st[a]);
}
a *= 2;
x >>= 1;
}
if (!flag) cout << -1 << endl;
else{
cout << ans.size() << endl;
sort(ans.begin(), ans.end());
for (int i = 0; i < ans.size(); i ++ ){
if (i == ans.size() - 1)
cout << ans[i] << endl;
else
cout << ans[i] << ' ';
}
}
}
return 0;
}