#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
const int L = 0, R = 255;
bool trivial(double c) {
return c <= L || c >= R;
}
double into_segment(double c) {
if (c - L <= 1e-9)
return L;
if (c - R >= -1e-9)
return R;
return c;
}
struct Color {
double r, g, b;
bool trivial() const {
return ::trivial(r) && ::trivial(g) && ::trivial(b);
}
double sqlen() const {
return r * r + g * g + b * b;
}
double len() const {
return sqrt(sqlen());
}
Color operator*(const double d) const {
return { r * d, g * d, b * d };
}
Color operator+(const Color other) const {
return { r + other.r, g + other.g, b + other.b };
}
Color operator-(const Color other) const {
return { r - other.r, g - other.g, b - other.b };
}
Color into() const {
return { into_segment(r), into_segment(g), into_segment(b) };
}
};
vector<pair<Color, double>> find_ans(const Color& c) {
if (c.sqlen() == 0)
return {};
if (c.trivial())
return { {c, c.len()} };
Color aim{ c.r == L ? L : R, c.g == L ? L : R, c.b == L ? L : R };
double mult = 1e18;
if (c.r < aim.r)
mult = min(mult, (R - L) / (aim.r - c.r));
if (c.g < aim.g)
mult = min(mult, (R - L) / (aim.g - c.g));
if (c.b < aim.b)
mult = min(mult, (R - L) / (aim.b - c.b));
Color target = (aim + (c - aim) * mult).into();
vector<pair<Color, double>> ans = find_ans(target);
ans.emplace_back(aim, (c - target).len());
return ans;
}
bool solve_test() {
Color c;
if (!(cin >> c.r >> c.g >> c.b))
return false;
vector<pair<Color, double>> ans = find_ans(c);
cout << ans.size() << '\n';
for (const pair<Color, double>& action : ans)
cout << action.first.r << ' ' << action.first.g << ' ' << action.first.b << ' ' << action.second << '\n';
return true;
}
void solve_tests() {
int t;
cin >> t;
for (int i = 0; i < t; ++i)
if (!solve_test())
break;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << setprecision(8) << fixed;
#ifdef ONPC
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
solve_tests();
}