function Main(input) {
    input = input.split("\n");
    for (i=0; i < input.length; i++) {
        var N = parseInt(input[i])
        tmp = input[i].split("")
        var c1 = tmp[2]
        var c2 = tmp[3]
        var c3 = tmp[4]
        var c4 = tmp[5]
        if (c1 === c2 && c3 === c4) {
            console.log('Yes')
        } else {
            console.log('No')
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
