#include #include #include using namespace __gnu_pbds; using namespace std; #define int int64_t template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; #define pi pair #define vi vector #define pb push_back #define all(x) (x).begin(), (x).end() template istream &operator>>(istream &in, vector &v) { for (auto &x : v) in >> x; return in; } template ostream &operator<<(ostream &out, const vector &v) { for (const auto &x : v) out << x << ' '; return out; } template istream &operator>>(istream &in, pair &p) { in >> p.first >> p.second; return in; } template ostream &operator<<(ostream &out, const pair &p) { out << p.first << ' ' << p.second; return out; } const int MOD = 1000000007; void solve() { vi a(3), b(3); cin >> a >> b; int max_win = min(a[0], b[1]) + min(a[1], b[2]) + min(a[2], b[0]); int min_win = max(0L, a[0] - b[0] - b[2]) + max(0L, a[1] - b[1] - b[0]) + max(0L, a[2] - b[2] - b[1]); cout << min_win << " " << max_win << '\n'; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; cin >> t; while (t--) solve(); return 0; }