//HEADER FILES//
     #include <map>
    #include <set>
    #include <list>
    #include <cmath>
    #include <ctime>
    #include<iomanip>
    #include <deque>
    #include <queue>
    #include <stack>
    #include <string>
    #include <bitset>
    #include <cstdio>
    #include <limits>
    #include <vector>
    #include <climits>
    #include <cstring>
    #include <cstdlib>
    #include <fstream>
    #include <numeric>
    #include <sstream>
    #include <iostream>
    #include <algorithm>
    #include <unordered_map>
    #include <unistd.h>
    //#########################################################################//

    //MACROS
    #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
    #define stringinput(s) string s; cin>>s;
    #define lc cout<<"\n";
    #define testcase int t; cin>>t; while(t--)
    #define umap unordered_map
    #define testcasei inti t; cin>>t; while (t--)
    #define notestcase inti t=1; while(t--)
    #define input(n) int n; cin>>n;
    #define inputi(n) inti n; cin>>n;
    #define inputl(n) li n ; cin>>n;
    #define display(a,n)  {int zzzz=n; for(auto x: a){ cout<<x<<" "; if(!(--zzzz)) break;} lc}
    #define pb push_back
    #define pause int zzz; cin>>zzz;
    #define arrayinput(a) for(int i=0;i<n;++i) cin>>a[i];
    #define floop(i,n)   for(__typeof(n) i=0;i<n;++i)
    #define foop(i,start,end) for(__typeof(end) i=start;i<end;++i)
    #define display2d(a,m,n)  for(int i=0;i<m;++i){ for(int j=0;j<n;++j) cout<<a[i][j]<<" "; lc  } lc
    #define MOD 1000000007
    const long MAX=10000000;
    //#########################################################################//
    using namespace std;
    //#########################################################################//
    typedef  long long int inti;
    typedef long int intl;

     struct trio{
        //string s,d;
        intl a,b,c;
        };
    struct duo{
        inti value,node;
         };

    //#########################################################################//


     //MISCELLENOUS FUNCTIONS//
     /*
 
   ostream& operator<<(ostream& cc,const trio& d)
     {


         return cc<<"("<<d.a<<","<<d.b<<" "<<d.c<<")"<<endl;


     }
    
*/
/*

    bool compare(duo t1,duo t2)
    {
        if(t1.value==t2.value)
        return(t1.node>t2.node);

        return(t1.value>t2.value);
    }
*/

///////////////
/////BFS///////

//vector<bool> v;

/*
void addedge(int a, int b)
{
    g[a].pb(b);


     g[b].pb(a);
}

void bfs(int u)
{
    queue<int> q;

    q.push(u);
    v[u] = true;

    while (!q.empty()) {

        int f = q.front();
        q.pop();

        cout << f << " ";

        // Enqueue all adjacent of f and mark them visited
        for (auto i = g[f].begin(); i != g[f].end(); i++) {
            if (!v[*i]) {
                q.push(*i);
                v[*i] = true;
            }
        }
    }
} 
*/




/*

source- https://www.geeksforgeeks.org/shortest-path-unweighted-graph/

bool BFS(vector<int> adj[], int src, int dest, int v, 
                            int pred[], int dist[]) 
{ 
    // a queue to maintain queue of vertices whose 
    // adjacency list is to be scanned as per normal 
    // DFS algorithm 
    list<int> queue; 
  
    // boolean array visited[] which stores the 
    // information whether ith vertex is reached 
    // at least once in the Breadth first search 
    bool visited[v]; 
  
    // initially all vertices are unvisited 
    // so v[i] for all i is false 
    // and as no path is yet constructed 
    // dist[i] for all i set to infinity 
    for (int i = 0; i < v; i++) { 
        visited[i] = false; 
        dist[i] = INT_MAX; 
        pred[i] = -1; 
    } 
  
    // now source is first to be visited and 
    // distance from source to itself should be 0 
    visited[src] = true; 
    dist[src] = 0; 
    queue.push_back(src); 
  
    // standard BFS algorithm 
    while (!queue.empty()) { 
        int u = queue.front(); 
        queue.pop_front(); 
        for (int i = 0; i < adj[u].size(); i++) { 
            if (visited[adj[u][i]] == false) { 
                visited[adj[u][i]] = true; 
                dist[adj[u][i]] = dist[u] + 1; 
                pred[adj[u][i]] = u; 
                queue.push_back(adj[u][i]); 
  
                // We stop BFS when we find 
                // destination. 
                if (adj[u][i] == dest) 
                   return true; 
            } 
        } 
    } 
  
    return false; 
} 
  
// utility function to print the shortest distance  
// between source vertex and destination vertex 
void printShortestDistance(vector<int> adj[], int s,  
                                    int dest, int v) 
{ 
    // predecessor[i] array stores predecessor of 
    // i and distance array stores distance of i 
    // from s 
    int pred[v], dist[v]; 
  
    if (BFS(adj, s, dest, v, pred, dist) == false) 
    { 
        cout << "Given source and destination"
             << " are not connected"; 
        return; 
    } 
  
    // vector path stores the shortest path 
    vector<int> path; 
    int crawl = dest; 
    path.push_back(crawl); 
    while (pred[crawl] != -1) { 
        path.push_back(pred[crawl]); 
        crawl = pred[crawl]; 
    } 
  
    // distance from source is in distance array 
    cout << "Shortest path length is : "
        << dist[dest]; 
  
    // printing path from source to destination 
    cout << "\nPath is::\n"; 
    for (int i = path.size() - 1; i >= 0; i--) 
        cout << path[i] << " "; 
} 






*/


/*
  vector<int> graph[MAX];
bool visited[MAX]={0};
 int cc=0;
void dfs(int n)
{
        if(visited[n]==0)
         cc++;

    visited[n]=1;


     for(auto x: graph[n])
     if(!visited[x]) dfs(x);
}

*/

//////////////////////
/////////////////////

/*
    template <typename V> //vector popping
    void pop_fron(V & v)
    {
        assert(!v.empty());
        v.erase(v.begin());
    }
 */
/*

    struct tree{

        int data;
        struct tree* left;
        struct tree* right; };

    struct tree* newnode(int data){

        struct tree* tree=(struct tree*)malloc(sizeof(struct tree));
        tree->data=data;
        tree->left=NULL;
        tree->right=NULL;
        return(tree);}
    /////////////////////////////////////////////////////////////////////
    
    struct Trunk
    {
    Trunk *prev;
    string str;

    Trunk(Trunk *prev, string str)
    {
        this->prev = prev;
        this->str = str;
    }};

    void showTrunks(Trunk *p)
{
    if (p == nullptr)
        return;

    showTrunks(p->prev);

    cout << p->str;}

    */

// Recursive function to print binary tree
// It uses inorder traversal

/*
void printTree(tree *root, Trunk *prev, bool isLeft)
{
    if (root == nullptr)
        return;
    
    string prev_str = "    ";
    Trunk *trunk = new Trunk(prev, prev_str);

    printTree(root->left, trunk, true);

    if (!prev)
        trunk->str = "---";
    else if (isLeft)
    {
        trunk->str = ".---";
        prev_str = "   |";
    }
    else
    {
        trunk->str = "`---";
        prev->str = prev_str;
    }

    showTrunks(trunk);
    cout << root->data << endl;

    if (prev)
        prev->str = prev_str;
    trunk->str = "   |";

    printTree(root->right, trunk, false);
}
//########################################################################
int maxDepth(struct tree* node) 
    {
        if (node==NULL) 
            return 0;
        else
        {
            
              int lDepth = maxDepth(node->left);
              int rDepth = maxDepth(node->right);

             
              if (lDepth > rDepth) 
                    return(lDepth+1);
              else 
                   return(rDepth+1);
       }
    } 
    */
    
  //#########################################################################// 
 //############ segment tree ################################


        

        void build(inti node,inti start,inti end,vector<inti>& tree,vector<inti> & a)
        {

            if(start==end)
             {
                    tree[node]=a[start];
                 return;
             }
           
             inti mid=(start+end)/2;

             build(2*node,start,mid,tree,a);
             build(2*node+1,mid+1,end,tree,a);
        
             tree[node]=__gcd(tree[2*node],tree[2*node+1]);

        }

       inti query(inti node,inti start,inti end,inti l, inti r,vector<inti>& tree)
       {
        inti mid=(start+end)/2;
        if( end<l or start > r )
        {
          return 0;
        }

         if(l<=start and end<=r)
          return tree[node];

          

          inti p1=query(2*node,start,mid,l,r,tree);
          inti p2=query(2*node+1,mid+1,end,l,r,tree);
          if(p1==0)
          p1=p2;
          if(p2==0)
          p2=p1;
          return __gcd(p1,p2);

       }
       void update(inti node,inti start,inti end,inti id,inti val,vector<inti>& tree,vector<inti>& a)
       {
           if(start==end)
           {
              tree[node]=val;
              a[id]=val;


           }
           else
           {


               inti mid=(start+end)/2;
               if( start<=id and id<=mid )
                    update(2*node,start,mid,id,val,tree,a);
                else
                     update(2*node+1,mid+1,end,id,val,tree,a);

                 tree[node]=__gcd(tree[2*node],tree[2*node+1]);

           }



       }



    //MAIN FUNCTION//
    int main()
    {
      // fastio
   notestcase
    {
string s;
cin>>s;

if(s[2]==s[3] and s[4]==s[5])
        cout<<"Yes";
        else
        cout<<"No";
       lc
    }
    return 0;
    }




Measured memory_bytes: 256