t=int(input())
def brute(ind,su=[0,0,0],co=0):
global ma
if ind==7:
if su[0]<=a and su[1]<=b and su[2]<=c:
ma=max(ma,co)
return
brute(ind+1,[su[i]+aa[ind][i] for i in range(3)],co+1)
brute(ind+1,su,co)
for i in range(t):
a,b,c=list(map(int,input().split()))
ma=0
aa=[[1,1,1],[1,1,0],[1,0,0],[1,0,1],[0,1,1],[0,1,0],[0,0,1]]
brute(0)
print(ma)
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define ll long long
#define frp(a, b) for(ll i = a; i < b; i++)
#define frn(a, b) for(ll i = a-1; i >= b; i--)
#define V2 vector < vector<ll> > v(n, vector <ll> (n));
#define in(x) insert(x)
#define pb(x) push_back(x)
#define full(x) x.begin(),x.end()
#define check cout << "aiseee" <<endl;
#define start int test; cin >> test; while(test--)
void setup();
void nahid();
void ishan();
int main()
{
setup();
// nahid();
ishan();
return 0;
}
void nahid()
{
// cout << "hel" << endl;
start
{
// cout << "hel" << endl;
// check
ll n, k; cin >> n >> k;
ll remem = 0;
map <int, int> mp;
for(ll i = 0; i < n; i++)
{
ll l, r; cin >> l >> r;
if(l <= k && k <= r)
{
for(ll j = l; j <= r; j++)
{
mp[j]++;
}
}
}
// cout << mp[k] << endl;
ll mx = 0;
for(auto &t : mp)
{
ll tmp = t.second;
mx = max(mx, tmp);
}
// cout << mx << endl;
ll c = 0;
for(auto &t : mp) if(mx == t.second) c++;
// cout << c << endl;
if(mp[k] == 0 || c > 1) cout << "NO" << endl;
else cout << "YES" << endl;
}
}
void ishan()
{
start
{
ll a, b, c; cin >> a >> b >> c;
ll happy = 0;
if(a+b+c == 0) cout << 0 << endl;
else if(a >= 4 && b >= 4 && c >= 4) cout << 7 << endl;
else
{
if(a < b) swap(a, b);
if(a < c) swap(a, c);
if(b < c) swap(b, c);
if(a > 0)
{
a--;
happy++;
}
if(b > 0)
{
b--;
happy++;
}
if(c > 0)
{
c--;
happy++;
}
if(a > 0 && b > 0)
{
a--;
b--;
happy++;
}
if(a > 0 && c > 0)
{
a--;
c--;
happy++;
}
if(b > 0 && c >> 0)
{
b--;
c--;
happy++;
}
if(a > 0 && b > 0 && c > 0)
{
a--;
b--;
c--;
happy++;
}
cout << happy << endl;
}
}
}
void setup()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#endif
}
/*
|-------------------------------------------------------------------------------------|
| # # # # # ### #### ### #### # # # # # |
| # # # # # # # # # # # # # # # # # # # |
| # # # ##### ##### # # # AKA # #### #### ##### # # # |
| # # # # # # # # # # # # # # # # # # # |
| # # # # # # ### #### ### #### # # # # # # |
|-------------------------------------------------------------------------------------|
*/
1143B - Nirvana | 1285A - Mezo Playing Zoma |
919B - Perfect Number | 894A - QAQ |
1551A - Polycarp and Coins | 313A - Ilya and Bank Account |
1469A - Regular Bracket Sequence | 919C - Seat Arrangements |
1634A - Reverse and Concatenate | 1619C - Wrong Addition |
1437A - Marketing Scheme | 1473B - String LCM |
1374A - Required Remainder | 1265E - Beautiful Mirrors |
1296A - Array with Odd Sum | 1385A - Three Pairwise Maximums |
911A - Nearest Minimums | 102B - Sum of Digits |
707A - Brain's Photos | 1331B - Limericks |
305B - Continued Fractions | 1165B - Polycarp Training |
1646C - Factorials and Powers of Two | 596A - Wilbur and Swimming Pool |
1462B - Last Year's Substring | 1608B - Build the Permutation |
1505A - Is it rated - 2 | 169A - Chores |
765A - Neverending competitions | 1303A - Erasing Zeroes |