import Foundation

// 入力
let input_line = readLine()!
let split = input_line.componentsSeparatedByString(" ")
let a = Int(split[0])! 
let b = Int(split[1])!
let c = Int(split[2])!

// 条件
let isOnTheWay = (a < c && c < b) || (a > c && c > b)

// 出力
print(isOnTheWay ? "YES" : "NO")