Problem: 2057C - Trip to the Olympiad
Language: c++17 

Solution 1 (runtime: 62 ms):
#include <algorithm>
#include <climits>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> PI;
typedef vector<PI> vii;
#define F first
#define S second
#define int ll
#define MP make_pair
#define PB push_back
#define tv takeVector
#define PV printVector
#define all(x) x.begin(), x.end()
#define FOR(i, a, b) for (ll i = a; i < (b); i++)
#define F0Rd(i, n) for (int i = n - 1; i >= 0; i--)
#define FORd(i, a, n) for (int i = n - 1; i >= a; i--)
#define F0R(i, b) for (ll i = 0; i < (b); i++)
#define iter(item, list) for (auto item : list)
#define SQ(a) (a) * (a)
const char nl = '\n';
const int MOD = 1e9 + 7;
const int mod = MOD;
void takeVector(vector<ll> &a) {
  for (auto &i : a) {
    cin >> i;
  }
}
void printVector(vector<int> arr) {
  FOR(i, 0, arr.size()) { cout << arr[i] << " "; }
  cout << endl;
}
void printVector(vector<PI> a) {
  for (auto i : a) {
    cout << i.F << " " << i.S << nl;
  }
}
const int MAX_N = 200005;
int MODpow(int x, int n, ll m) {
  if (n == 0) {
    return 1 % m;
  }
  if (n & 1) {
    ll u = MODpow(x, n - 1, m);
    return (x % m) * (u % m) % m;
  } else {
    ll u = MODpow(x, n / 2, m) % m;
    return (u * u) % m;
  }
}
string s, t;
bool multi = true;
int n, b, m, q, l, k, r, x, y, z, w;
int ans;
void solve() {
    cin>>l>>r;
    int k = 31 - __builtin_clz(l^r);
    int x = l |( (1<<k) - 1);
    y = x+1;
    z = (x == l ? r : l);
    cout<<x<<" "<<y<<" "<<z<<nl;
}
signed main() {

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  if (multi)
    cin >> t;
  while (t--)
    solve();

  return 0;
}


Solution 2 (runtime: 61 ms):
/*
  __  __          _    _ _____            _   _
 |  \/  |   /\   | |  | |  __ \     /\   | \ | |
 | \  / |  /  \  | |__| | |__) |   /  \  |  \| |
 | |\/| | / /\ \ |  __  |  _  /   / /\ \ | . ` |
 | |  | |/ ____ \| |  | | | \ \  / ____ \| |\  |
 |_|  |_/_/    \_\_|  |_|_|  \_\/_/    \_\_| \_|
                                                     */
#include <bits/stdc++.h>
#include <cmath> // Include cmath for M_PI
#ifndef M_PI
#define M_PI 3.14159265358979323846 // Define M_PI if not already defined
#endif
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ull unsigned long long
#define endl "\n"
using namespace std;
/*
pair<int, int> t[4*MAXN];

pair<int, int> combine(pair<int, int> a, pair<int, int> b) {
    if (a.first > b.first)
        return a;
    if (b.first > a.first)
        return b;
    return make_pair(a.first, a.second + b.second);
}

void build(int a[], int v, int tl, int tr) {
    if (tl == tr) {
        t[v] = make_pair(a[tl], 1);
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        t[v] = combine(t[v*2], t[v*2+1]);
    }
}

pair<int, int> get_max(int v, int tl, int tr, int l, int r) {
    if (l > r)
        return make_pair(-INF, 0);
    if (l == tl && r == tr)
        return t[v];
    int tm = (tl + tr) / 2;
    return combine(get_max(v*2, tl, tm, l, min(r, tm)),
                   get_max(v*2+1, tm+1, tr, max(l, tm+1), r));
}

void update(int v, int tl, int tr, int pos, int new_val) {
    if (tl == tr) {
        t[v] = make_pair(new_val, 1);
    } else {
        int tm = (tl + tr) / 2;
        if (pos <= tm)
            update(v*2, tl, tm, pos, new_val);
        else
            update(v*2+1, tm+1, tr, pos, new_val);
        t[v] = combine(t[v*2], t[v*2+1]);
    }
}
*/

template <typename T>
void pop_front(std::vector<T> &v)
{
    if (v.size() > 0)
    {
        v.erase(v.begin());
    }
}
const int MOD = 1e9 + 7;
long long binpow(long long a, long long b, long long m)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
bool sortFirst(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    if (a.first == b.first)
    {
        return a.second > b.second;
    }
    return a.first < b.first;
}

void solve()
{
    ll l, r;
    cin >> l >> r;
    int i = 31;
    bool t = false;
    bool tt = false;
    for (; i >= 0; i--)
    {
        if ((1LL << i) & l)
        {
            t = true;
        }
        if ((1LL << i) & r)
        {
            tt = true;
        }
        if (t && tt)
        {
            break;
        }
    }
    int j = i;
    for (; j >= 0; j--)
    {
        if (((1LL << j) & l) && !((1LL << j) & r))
        {
            break;
        }
    }
    ll k = 31 - __builtin_clz(l ^ r);
    ll a = l | ((1LL << k) - 1);
    ll b = a + 1;
    ll c = l;
    if (a == l)
    {
        c = r;
    }
    cout << a << " " << b << " " << c << endl;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}