function Main(input) {
    const A = parseInt(input[0])
    const B = parseInt(input[1])
    const C = parseInt(input[2])
    
    if((A < C && C < B) || (B < C && C < A)) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}

// 改行・空白で分割
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));