#include using namespace std; char s[7]; int main() {int t; cin>>t; cin.get(); while(t--) { cin.getline(s,6); if(s[3]==s[4]&&s[3]=='0') {cout<<"YES"<