using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] mas = Console.ReadLine().Split(' ');
            double hours = Convert.ToDouble(mas[0]);
            double minutes = Convert.ToDouble(mas[1]);
            double seconds = Convert.ToDouble(mas[2]);
            int t1 = Int32.Parse(mas[3]);
            int t2 = Int32.Parse(mas[4]);
            List<double> grads = new List<double>();
            grads.Add(seconds * 6);
            grads.Add(minutes * 6 + seconds / 60);

            if (hours == 12)
            {
                grads.Add(minutes / 60 + seconds / 3600);
            }
            else grads.Add(hours * 30 + minutes / 60 + seconds / 3600);

            t1 *= 30;
            t2 *= 30;

            bool gtfo;
            Line(grads, t1, t2, out gtfo);
            bool gtfo2;
            LineThrough(grads, t1, t2, out gtfo2);

            if(gtfo == false || gtfo2 == false)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

        }

        private static void LineThrough(List<double> grads, int t1, int t2, out bool gtfo)
        {
            gtfo = false;

            if(t1>t2)
            {
                var g = from n in grads
                        where n > t1
                        select n;
                foreach(int i in g)
                {
                    gtfo = true;
                    return;
                }
                var g1 = from n in grads
                        where n < t2
                        select n;
                foreach(int i in g1)
                {
                    gtfo = true;
                    return;
                }
            }
            else
            {
                var g = from n in grads
                        where n < t1
                        select n;
                foreach (int i in g)
                {
                    gtfo = true;
                    return;
                }
                var g1 = from n in grads
                         where n > t2
                         select n;
                foreach (int i in g1)
                {
                    gtfo = true;
                    return;
                }
            }
        }

        private static void Line(List<double> grads, int t1, int t2, out bool gtfo)
        {
            gtfo = false;

            if (t1 > t2)
            {
                var g = from n in grads
                        where n > t2
                        where n < t1
                        select n;

                foreach (int i in g)
                {
                    gtfo = true;
                    return;
                }
            }
            else
            {
                var g = from n in grads
                        where n < t2
                        where n > t1
                        select n;

                foreach (int i in g)
                {
                    gtfo = true;
                    return;
                }
            }
            return;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            List<double> l = new List<double>();
            List<double> ll = new List<double>();
            foreach (var b in a)
            {
                var c = double.Parse(b);
                l.Add(c);
            }
            l[0] = (l[0] == 12 ? 0d : l[0] + l[1] / 60d + l[2] / 3600d) * 5;
            l[1] = l[1] + l[2] / 60;
            var t1 = l[3] * 5;
            var t2 = l[4] * 5;
            for(int i = 0; i < 3; i++)
            {
                ll.Add(l[i]);
            }
            ll.Sort();

            var llmx = ll.Max();
            var llmn = ll.Min();
            if (llmx < t1 && llmx < t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (llmn > t1 && llmn > t2)
            {

                Console.WriteLine("YES");
                return;
            }

            //

            if (ll[0] < t1 && ll[1] > t1 && ll[0] < t2 && ll[1] > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            if (ll[1] < t1 && ll[2] > t1 && ll[1] < t2 && ll[2] > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            //
            if (t1 > t2)
            {
                Swap(ref t1,ref t2);
            }
            if (t2 > llmx && t1 < llmn)
            {

                Console.WriteLine("YES");
                return;
            }
            Console.WriteLine("NO");

            }
        public static void Swap<T>(ref T lhs, ref T rhs)
        {
            T temp = lhs;
            lhs = rhs;
            rhs = temp;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class ADiv2
   {
      static void Main(string[] args)
      {
          string[] token  = Console.ReadLine().Split();
          int h = int.Parse(token[0])* 10 + 1;;
          int m = int.Parse(token[1])* 2 + 1;
          int s = int.Parse(token[2])* 2 + 1;
          int t1 = int.Parse(token[3]) *10;
          int t2 = int.Parse(token[4]) *10;

          int[] a = new int[5]{h,m,s,t1,t2};
          Array.Sort(a);
         for (int i = 0; i < a.Length; ++i) {
                if (a[i] % 2 == 0 && a[(i + 1) % a.Length] % 2 == 0) {
                    Console.WriteLine("YES");
                    return;
                }
          }
          Console.WriteLine("NO");

      }
   }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Numerics;

namespace ConsoleApplication1
{

    class Program
    {

        static TextReader sr;
        static TextWriter sw;

        enum Direction {Vertical, Horizontal }

        static void Main(string[] args)
        {
            if (File.Exists("input.txt"))
            {
                sr = new StreamReader("input.txt");
                sw = new StreamWriter("output.txt");
            }
            else
            {
                sr = Console.In;
                sw = Console.Out;
            }
            Solve();
            if (File.Exists("input.txt"))
            {
                sr.Close();
                sw.Close();
            }
        }

        static void Solve()
        {
            int h = ReadInt() * 5, m = ReadInt(), s = ReadInt(), start = ReadInt() * 5, stop = ReadInt() * 5;
            if (h == 60)
                h = 0;
            if (start == 60)
                start = 0;
            if (stop == 60)
                stop = 0;
            h ++;
            if (m % 5 == 0)
                m++;
            if (stop < start)
            {
                int temp = stop;
                stop = start;
                start = temp;
            }
            if (start == stop)
            {
                sw.WriteLine("YES");
                return;
            }
            bool f1 = false, f2 = false;
            if ((h > start && h < stop) || (m > start && m < stop) || (s > start && s < stop))
            {
                f1 = true;
            }
            if ((!(h > start && h < stop)) || (!(m > start && m < stop)) || (!(s > start && s < stop)))
            {
                f2 = true;
            }
            if (f1 && f2)
            {
                sw.WriteLine("NO");
            }
            else
            {
                sw.WriteLine("YES");
            }
        }

        static int comparator(Pair<Pair<int, int>, Pair<int, int>> a, Pair<Pair<int, int>, Pair<int, int>> b)
        {
            if (a.first.first == b.first.first)
            {
                if (a.first.second == b.first.second)
                {
                    return a.CompareTo(b);
                }
                else
                {
                    return b.first.second - a.first.second;
                }
            }
            else
            {
                return a.first.first - b.first.first;
            }
        }

        static long ariphmeticsum(long n)
        {
            return n * (n + 1) / 2;
        }

        static bool check()
        {
            return true;
        }

        static long getManhattan(Pair<long, long> a, Pair<long, long> b)
        {
            return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);
        }

        static string[] buffer = new string[0];
        static int counterbuffer = 0;

        static Graph ReadGraph()
        {
            int n = ReadInt();
            int m = ReadInt();
            int[] a = new int[m];
            int[] b = new int[m];
            for (int i = 0; i < m; i++)
            {
                a[i] = ReadInt();
                b[i] = ReadInt();
            }
            return new Graph(n, a, b);
        }

        static Graph<T> ReadGraph<T>(Parser<T> parser)
            where T: IComparable<T>
        {
            int n = ReadInt();
            int m = ReadInt();
            int[] a = new int[m];
            int[] b = new int[m];
            T[] c = new T[m];
            for (int i = 0; i < m; i++)
            {
                a[i] = ReadInt();
                b[i] = ReadInt();
                c[i] = Read<T>(sr, parser);
            }
            return new Graph<T>(n, a, b, c);
        }

        static int[] ReadArrayInt()
        {
            return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static long[] ReadArrayLong()
        {
            return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static int[][] ReadMatrixInt(int n, int m)
        {
            int[][] answer = new int[n][];
            for (int i = 0; i < n; i++)
            {
                answer[i] = new int[m];
                for (int j = 0; j < m; j++)
                {
                    answer[i][j] = ReadInt();
                }
            }
            return answer;
        }

        static long[][] ReadMatrixLong(int n, int m)
        {
            long[][] answer = new long[n][];
            for (int i = 0; i < n; i++)
            {
                answer[i] = new long[m];
                for (int j = 0; j < m; j++)
                {
                    answer[i][j] = ReadLong();
                }
            }
            return answer;
        }

        static BigInteger ReadBigInteger()
        {
            return ReadBigInteger(sr);
        }

        static BigInteger ReadBigInteger(TextReader sr)
        {
            return Read<BigInteger>(sr, BigInteger.Parse);
        }

        static int ReadInt()
        {
            return ReadInt(sr);
        }

        static int ReadInt(TextReader sr)
        {
            return Read<int>(sr, int.Parse);
        }

        static long ReadLong()
        {
            return ReadLong(sr);
        }

        static long ReadLong(TextReader sr)
        {
            return Read<long>(sr, long.Parse);
        }

        static double ReadDouble()
        {
            return ReadDouble(sr);
        }

        static double ReadDouble(TextReader sr)
        {
            return Read<double>(sr, double.Parse);
        }

        static string ReadString()
        {
            return ReadString(sr);
        }

        static string ReadString(TextReader sr)
        {
            return Read<string>(sr, x => x);
        }

        static U Read<U>(TextReader sr, Parser<U> parser)
        {
            if (counterbuffer >= buffer.Length)
            {
                buffer = sr.ReadLine().Split(' ').ToArray();
                while (buffer.Length == 0)
                {
                    buffer = sr.ReadLine().Split(' ').ToArray();
                }
                counterbuffer = 0;
            }
            return parser(buffer[counterbuffer++]);
        }
    }

    public delegate U Parser<U>(string str);

    class Graph
    {
        protected int[][] Edges;
        public int this[int val1, int val2]
        {
            get
            {
                return Edges[val1][val2];
            }
            set
            {
                Edges[val1][val2] = value;
            }
        }

        public Graph(int n, int[] a, int[] b)
        {
            generateEdges(n, a, b);
        }

        private void generateEdges(int n, int[] a, int[] b)
        {
            int[] temp = new int[n];
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] != b[i])
                {
                    temp[a[i] - 1]++;
                    temp[b[i] - 1]++;
                }
                else
                {
                    temp[a[i] - 1]++;
                }
            }
            Edges = new int[n][];
            for (int i = 0; i < n; i++)
            {
                Edges[i] = new int[temp[i]];
            }
            for (int i = 0; i < n; i++)
            {
                temp[i] = 0;
            }
            for (int j = 0; j < a.Length; j++)
            {
                if (a[j] != b[j])
                {
                    Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;
                    Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;
                }
                else
                {
                    Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;
                }
            }
        }

        public override string ToString()
        {
            string answer = "";
            foreach (var i in Edges)
            {
                foreach (var j in i)
                {
                    answer += (j+1) + " ";
                }
                answer += Environment.NewLine;
            }
            return answer;
        }
    }

    class Graph<T> : Graph
        where T: IComparable<T>
    {
        public T[][] Cost;
        public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)
        {
            this.GenerateEdges(n, a, b, c);
        }

        private void GenerateEdges(int n, int[] a, int[] b, T[] c)
        {
            Cost = new T[n][];
            for (int i = 0; i < n; i++)
            {
                Cost[i] = new T[Edges[i].Length];
            }
            int[] temp = new int[n];

            for (int j = 0; j < c.Length; j++)
            {
                if (a[j] != b[j])
                {
                    Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];
                    Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];
                }
                else
                {
                    Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];
                }
            }
        }

        public override string ToString()
        {
            string answer = "";
            for (int i = 0; i < Cost.Length; i++)
            {
                for (int j = 0; j < Cost[i].Length; j++)
                {
                    answer += (i + 1) + " " + (Edges[i][j] + 1) + " " + Cost[i][j] + Environment.NewLine;
                }
            }
            return answer;
        }
    }

    class Pair<U, V> : IComparable<Pair<U, V>>
         where U : IComparable<U> where V : IComparable<V>
    {
        public U first;
        public V second;
        public Pair(U first, V second)
        {
            this.first = first;
            this.second = second;
        }

        public int CompareTo(Pair<U, V> b)
        {
            if (first.CompareTo(b.first) == 0)
            {
                return second.CompareTo(b.second);
            }
            return first.CompareTo(b.first);
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Race_Against_Time
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve() ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve()
        {
            int h = Next() % 12, m = Next(), s = Next(), t1 = Next() % 12, t2 = Next() % 12;

            if (t1 > t2)
            {
                int t = t1;
                t1 = t2;
                t2 = t;
            }

            double hd = m > 0 || s > 0 ? h + 0.1 : h;
            double md = s > 0 ? m*12.0/60 + 000.1 : m*12.0/60;
            double sd = s*12.0/60;

            bool hb = hd > t1 && hd < t2;
            bool mb = md > t1 && md < t2;
            bool sb = sd > t1 && sd < t2;

            return (hb && mb && sb) || (!hb && !mb && !sb);
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

public static partial class MyExtension
{
    public const int DEFAULT_BUFFER_SIZE = 4194304;
    public class Solution
    {
        /* Head ends here */

        public const int PAD_FACTOR = 7;

        public static double div(double dividend, double divisor) { return dividend / divisor; }

        static int hour60(int hour12)
        {
            if (hour12 == 12) hour12 = 0;
            return hour12 * 5;
        }

        bool solve()
        {
            // he doesn't have to move forward only: in these circumstances time has no direction.
            // 1 ≤ h ≤ 12
            // 0 ≤ m, s ≤ 59
            // 1 ≤ t1, t2 ≤ 12

            var H = ReadInt32();
            var M = ReadInt32();
            var S = ReadInt32();
            var T1 = ReadInt32();
            var t1 = hour60(T1);
            var T2 = ReadInt32();
            var t2 = hour60(T2);
            var m = M + div(S, 60);
            var h = hour60(H) + div(M, 60) + div(S, 3600);

            // 1 - t1
            // 2 - t2
            // 3 blocker
            var a = new[] { h, m, S, t1, t2 };
            var b = a.Distinct().ToList();
            b.Sort();
            var arr = b.Concat(b).ToList();
            foreach(var i in range(1, arr.Count - 2))
            {
                if(arr[i] == t1)
                {
                    if (arr[i - 1] == t2 || arr[i + 1] == t2)
                        return true;
                }
            }
            return false;
        }

        public void zStart()
        {
            Console.WriteLine(solve() ? "YES" : "NO");
            ///////////////////////////////////////

            //foreach (var @__ in Enumerable.Range(1, ReadInt32()))
            //{
                // start... - no CONSOLE

                // end...

                //var ansLines = new List<string>(9999);
                //{
                //    // ANS start...

                //    //ansLines.AddRange(inp.Select(x => new string(x)));
                //    //...

                //    Console.Write("Case #{0}: ", @__);
                //    Console.WriteLine(string.Join(" ", __getFormattedString(ans)));
                //    ansLines.ForEach(x => Console.WriteLine(x));
                //}
                //Trace.WriteLine(string.Format("DONE_{0}.", @__));
            //}
        }

        T __getFormattedString<T>(T val) { return val; }
#if DEBUG
        string __getFormattedString(double d) { return d.ToString("0.000000"); }
#endif
        /* Tail starts here */
    }

#if TORIQ
    static void Pretest()
    {
        Test(@"12 0 1 12 1", "YES");
        Test(@"3 47 0 4 9", "YES");
    }
    static void MainTest()
    {
        Test(File.ReadAllText("input.txt")
            , File.ReadAllText("output.txt")
            );
        //
    }
#endif

    // =============================================================================================

    #region faSTDIO
    [DebuggerNonUserCode]
    static void Main(String[] args)
    {
#if TORIQ
        zTestSuite();
        //new Solution().zInternalTestSuite();
        return;
#endif
#if GOOGLE
        zGoogle();
        return;
#endif
        new Solution().zStart();
    }

    static IEnumerable<char> Read()
    {
        int cin;
        var empty = true;
        while ((cin = Console.Read()) > -1)
        {
            var c = (char)cin;
            if (c == ' ' || c == '\n' || c == '\r' || c == '\t')
            {
                if (empty) continue;
                else break;
            }
            yield return c;
            empty = false;
        }
    }
    static T Read<T>(Converter<string, T> convert, int capacity = 20)
    { var temp = ReadString(capacity); return convert(temp); }
    static string ReadString(int capacity = 1000000)
    {
        capacity += Solution.PAD_FACTOR;
        var ans = new System.Text.StringBuilder(capacity);
        foreach (var c in Read()) ans.Append(c);
        return ans.ToString();
    }
    static string ReadLine(int capacity = DEFAULT_BUFFER_SIZE)
    {
        capacity += Solution.PAD_FACTOR;
        var ans = Console.ReadLine();
        if (string.IsNullOrWhiteSpace(ans.Trim()))
            ans = Console.ReadLine();
        return ans;
    }
    static int ReadInt32() { return Read(Convert.ToInt32); }
    static long ReadLong64() { return Read(Convert.ToInt64); }

    #endregion
    #region LIBS
    [DebuggerNonUserCode]
    public static void assert(bool mustBeTrue, string message = "ASSERTION FAILED", params object[] args)
    {
        if (mustBeTrue == false)
            throw new ApplicationException(string.Format(message, args));
    }

    [DebuggerNonUserCode]
    public static T assert<T>(T actual, T expected)
    {
        if (object.Equals(actual, expected) == false)
        {
            Debug.WriteLine(expected, "CORRECT");
            Debug.WriteLine(actual, "ACTUAL");
            assert(false, "[{0}] SHOULD BE [{1}]", actual, expected);
        }
        return actual;
    }

    [Conditional("DEBUG")]
    public static void EmptyConditionalDebugBreak() { }

    public static bool isLrLeftRight<T>(T left, T right) where T : IComparable<T>
    { return left.CompareTo(right) <= 0; }

    [DebuggerNonUserCode]
    public static void lrLeftRight_ASSERT<T>(T left, T right) where T : IComparable<T>
    { assert(isLrLeftRight(left, right), "Expect left [{0}] <= [{1}] right", left, right); }

    public static IEnumerable<T> forEach<T>(this IEnumerable<T> range, Action<T> action)
    { foreach (var elem in range) action(elem); return range; }

    [DebuggerNonUserCode]
    public static void __AssertIncrStep(double incrStep) { assert(incrStep > 0, "Expect 'incrStep [{0}] > 0'", incrStep); }

    public static IEnumerable<int> range(int left, int right, int incrStep = 1)
    {
        lrLeftRight_ASSERT(left, right);
        __AssertIncrStep(incrStep);
        for (var i = left; i <= right; i += incrStep) yield return i;
    }
    public static IEnumerable<int> rangeReverse(int left, int right, int decrStep = 1)
    {
        lrLeftRight_ASSERT(left, right);
        __AssertIncrStep(decrStep);
        for (var i = right; i >= left; i -= decrStep) yield return i;
    }

    #endregion

    // =============================================================================================

}

#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace _438b
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION

            var d = readIntArray();
            var h = d[0];
            var m = d[1];
            var s = d[2];
            var t1 = d[3];
            var t2 = d[4];

            var count = 60 * 60;
            var inm = count / 5;
            var ins = inm / 60;

            var hs = (h * count + m * 60 + s) % (12 * count);
            var ms = m * inm + s * ins;
            var ss = s * inm;

            var hm = hs;
            var t1m = (t1 * count) % (12 * count);
            var t2m = (t2 * count) % (12 * count);
            var all = new int[] { hs, ms, ss };
            //var hc = (5L / 60L) / 60L;

            if (t1m > t2m)
            {
                if (!all.Any(t => t < t1m && t > t2m))
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (!all.Any(t => t > t1m || t < t2m || t == 0))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            else
            {
                if (!all.Any(t => t > t1m && t < t2m))
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (!all.Any(t => t < t1m || t > t2m || t == 0))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }

            Console.WriteLine("NO");
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        //static Tuple hToM(int h, int m, int s)
        //{

        //    return (h * 5) % 60;
        //}

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}

using System;
 using System.Collections.Generic;
 using System.Globalization;
using System.IO;
using System.Linq;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;
        private int s;
        private Tuple<long, long, long>[] array;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var h = sr.NextInt32()%12;
            var m = sr.NextInt32();
            var s = sr.NextInt32();
            var t1 = sr.NextInt32()%12;
            var t2 = sr.NextInt32()%12;
            var checkClock = CheckClock(h, m, s, t1, t2);
            var checkAntiClock = CheckAntiClock(h, m, s, t1, t2);
            if (checkClock || checkAntiClock) {
                sw.WriteLine("YES");
            }
            else {
                sw.WriteLine("NO");
            }
        }

        private bool CheckClock(int h, int m, int s, int t1, int t2)
        {
            var hPos = h * 60 * 60 + m * 60 + s;
            var hMax = 60 * 60 * 12;
            var t1h = 60 * 60 * t1;
            if (t1h == hMax)
                t1h = 0;
            var t2h = 60 * 60 * t2;
            if (t2h == hMax)
                t2h = 0;
            if (hPos == hMax)
                hPos = 0;
            var t = t1h;
            var can = true;
            while (t != t2h) {
                if (t == hPos) {
                    can = false;
                    break;
                }
                t++;
                if (t == hPos) {
                    can = false;
                    break;
                }
                if (t == hMax) {
                    t = 0;
                    if (t == hPos) {
                        can = false;
                        break;
                    }
                }
            }
            var mMax = 60 * 60;
            var mPos = 60 * m + s;
            var t1M = t1*5 * 60;
            var t2M = t2*5 * 60;
            if (mPos == mMax)
                mPos = 0;
            if (t1M == mMax)
                t1M = 0;
            if (t2M == mMax)
                t2M = 0;
            var tM = t1M;

            while (tM != t2M) {
                if (tM == mPos) {
                    can = false;
                    break;
                }
                tM++;
                if (tM == mPos) {
                    can = false;
                    break;
                }
                if (tM == mMax) {
                    tM = 0;
                    if (tM == mPos) {
                        can = false;
                        break;
                    }
                }
            }
            var sMax = 60;
            var sPos = s;
            var t1S = t1*5;
            var t2S = t2*5;
            if (sPos == sMax)
                sPos = 0;
            if (t1S == sMax)
                t1S = 0;
            if (t2S == sMax)
                t2S = 0;
            var tS = t1S;
            while (tS != t2S) {
                if (tS == sPos) {
                    can = false;
                    break;
                }
                tS++;
                if (tS == sPos) {
                    can = false;
                    break;
                }
                if (tS == sMax) {
                    tS = 0;
                    if (tS == sPos) {
                        can = false;
                        break;
                    }
                }
            }

            return can;
        }

        private bool CheckAntiClock(int h, int m, int s, int t1, int t2)
        {
            var hPos = h * 60 * 60 + m * 60 + s;
            var hMax = 60 * 60 * 12;
            var t1h = 60 * 60 * t1;
            if (t1h == hMax)
                t1h = 0;
            var t2h = 60 * 60 * t2;
            if (t2h == hMax)
                t2h = 0;
            if (hPos == hMax)
                hPos = 0;
            var t = t1h;
            var can = true;
            while (t != t2h) {
                if (t == hPos) {
                    can = false;
                    break;
                }
                t--;
                if (t == hPos) {
                    can = false;
                    break;
                }
                if (t < 0) {
                    t = hMax - 1;
                    if (t == hPos) {
                        can = false;
                        break;
                    }
                }
            }
            var mMax = 60 * 60;
            var mPos = 60 * m + s;
            var t1M = t1*5 * 60;
            var t2M = t2*5 * 60;
            if (mPos == mMax)
                mPos = 0;
            if (t1M == mMax)
                t1M = 0;
            if (t2M == mMax)
                t2M = 0;
            var tM = t1M;

            while (tM != t2M) {
                if (tM == mPos) {
                    can = false;
                    break;
                }
                tM--;
                if (tM == mPos) {
                    can = false;
                    break;
                }
                if (tM < 0) {
                    tM = mMax - 1;
                    if (tM == mPos) {
                        can = false;
                        break;
                    }
                }
            }
            var sMax = 60;
            var sPos = s;
            var t1S = t1*5;
            var t2S = t2*5;
            var tS = t1S;
            while (tS != t2S) {
                if (tS == sPos) {
                    can = false;
                    break;
                }
                tS--;
                if (tS == sPos) {
                    can = false;
                    break;
                }
                if (tS < 0) {
                    tS = sMax - 1;
                    if (tS == sPos) {
                        can = false;
                        break;
                    }
                }
            }

            return can;
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }

        public static decimal ConvertMinuteToMunite(int minute, int second = 0)
        {
            return minute + (decimal)second / 6 / 10;
        }
        public static decimal ConvertHourToMunite(int hour, int minute = 0, int second = 0)
        {
            //12.00-12.11 = 0
            //12.12-12.23 = 1
            //12.24-12.35 = 2
            //12.36-12.47 = 3
            //12.48-12.59 = 4

            int hInM = 5 * hour;
            if (hInM == 60) hInM = 0;
            return hInM + ((decimal) ConvertMinuteToMunite(minute, second) / 12);//+ ((decimal) second / 6 / 10);
            //return hInM;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {

#if __debug
            var str = "1 59 59 2 3";
#else
            var str = Console.ReadLine();
#endif

            var h = Convert.ToInt32(str.Split(' ')[0]);
            var m = Convert.ToInt32(str.Split(' ')[1]);
            var s = Convert.ToInt32(str.Split(' ')[2]);

            var t1 = Convert.ToInt32(str.Split(' ')[3]);
            var t2 = Convert.ToInt32(str.Split(' ')[4]);

            Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m, s), TestExtensions.ConvertMinuteToMunite(m,s), s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));
        }

        static string Check(decimal hm, decimal mm, decimal sm, decimal t1, decimal t2)
        {
#if __debug
            Console.WriteLine($"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}");
#else

#endif
            //теперь у меня есть шкала 0-60 двунаправленная

            //надо глянуть преграды в 2 стороны между т1 и т2

            //пойдем всегда от меньшего к большему, так проще
            var tmin = t1 > t2 ? t2 : t1;
            var tmax = t1 > t2 ? t1 : t2;

            //пробуем пойти вперед от tmin до tmax ища пустой промежуток
            //if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            if ((tmin > hm || tmax < hm) && (tmin > mm || tmax < mm) && (tmin > sm || tmax < sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }
            //пробуем пойти назад от tmin до 0 и вперед от tmax до 60 ища пустой промежуток
            //if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))
            if (tmin == 0 || (tmin < hm && tmin < mm && tmin < sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по убыванию до 0 для tmin");
#endif
                //if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))
                if (tmax == 60 || (tmax > hm && tmax > mm && tmax > sm))
                {
#if __debug
                    Console.WriteLine($"Нет преград по возрастанию до 60 для tmax");
#endif
                    return "YES";
                }
            }

            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }

            return "NO";
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Problem2
{
    public static void Main(string[] args)
    {
        int[] inp = Console.ReadLine().Split().Select(_ => int.Parse(_)).ToArray();

        HashSet<int> bounds = new HashSet<int>();
        bounds.Add((inp[0] * 3600 + inp[1]*60 + inp[2]) % 43200);
        bounds.Add((inp[1]*720+inp[2]*12) % 43200);
        bounds.Add(inp[2]*720);

        int from = (inp[3]*3600) % 43200;
        int to = (inp[4]*3600) % 43200;

        bool fail1 = false;
        bool fail2 = false;

        for (int x = from; x != to; x = (x+1)%43200)
        {
            if (bounds.Contains(x)) {
                fail1 = true;
                break;
            }
        }

        for (int x = from; x != to; x = (x+43199)%43200)
        {
            if (bounds.Contains(x)) {
                fail2 = true;
                break;
            }
        }

        if (fail1 && fail2)
        {
            Console.WriteLine("NO");
        }
        else
        {
            Console.WriteLine("YES");
        }
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 5;
        int m = fl[1];
        int s = fl[2];
        int t1 = fl[3] * 5;
        int t2 = fl[4] * 5;

        if (h == 60){
            h = 0;
        }
        if (t1 == 60){
            t1 = 0;
        }
        if (t2 == 60){
            t2 = 0;
        }
        h++;
        if (m % 5 == 0){
            m++;
        }

        if (t1 > t2)
        {
            var t = t1;
            t1 = t2;
            t2 = t;
        }

        if ((h < t1 || h > t2) && (m < t1 || m > t2) && (s < t1 || s > t2))
        {
            Console.WriteLine("YES");
            return;
        }

        bool backwords = false;
        bool forwards = false;

        if (t1 < h && t1 < m && t1 < s)
        {
            backwords = true;
        }

        if (t2 > h && t2 >= m && t2 >= s)
        {
            forwards = true;
        }

        if (backwords && forwards)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

    }
}

using System;

namespace PracticeCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int h, m, s, t1, t2;
            string[] str = Console.ReadLine().Split(' ');
            h = int.Parse(str[0]) * 5 - 1;
            m = int.Parse(str[1]);
            s = int.Parse(str[2]);
            t1 = int.Parse(str[3]) * 5 - 1;
            t2 = int.Parse(str[4]) * 5 - 1;

            int t = ((t2 - t1) + 60) % 60;
            int th = ((t2 - h) + 60) % 60;
            int tm = ((t2 - m) + 60) % 60;
            int ts = ((t2 - s) + 60) % 60;

            if ((t < th && t < tm && t < ts) || (t >= th && t >= tm && t >= ts))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

using System;

namespace PracticeCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int h, m, s, t1, t2;
            string[] str = Console.ReadLine().Split(' ');
            h = int.Parse(str[0]) * 5 - 1;
            m = int.Parse(str[1]);
            s = int.Parse(str[2]);
            t1 = int.Parse(str[3]) * 5 - 1;
            t2 = int.Parse(str[4]) * 5 - 1;

            int t = ((t2 - t1) + 60) % 60;
            int th = ((t2 - h) + 60) % 60;
            int tm = ((t2 - m) + 60) % 60;
            int ts = ((t2 - s) + 60) % 60;

            if ((t <= th && t <= tm && t <= ts) || (t >= th && t >= tm && t >= ts))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

using System;

namespace PracticeCS
{
    class Program
    {
        static void Main(string[] args)
        {
            int h, m, s, t1, t2;
            string[] str = Console.ReadLine().Split(' ');
            h = int.Parse(str[0]) * 5;
            m = int.Parse(str[1]);
            s = int.Parse(str[2]);
            t1 = int.Parse(str[3]) * 5;
            t2 = int.Parse(str[4]) * 5;

            int t = ((t2 - t1) + 60) % 60;
            int th = ((t2 - h) + 60) % 60;
            int tm = ((t2 - m) + 60) % 60;
            int ts = ((t2 - s) + 60) % 60;

            if ((t <= th && t <= tm && t <= ts) || (t >= th && t >= tm && t >= ts))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }

        public static int ConvertHourToMunite(int hour, int minute = 0)
        {
            //12.00-12.12 = 0
            //12.12-12.24 = 1
            //12.24-12.36 = 2
            //12.36-12.48 = 3
            //12.48-13.00 = 4
            int hInM = 0;
            switch (hour)
            {
                case 1:
                    hInM = 5;
                    break;
                case 2:
                    hInM = 10;
                    break;
                case 3:
                    hInM = 15;
                    break;
                case 4:
                    hInM = 20;
                    break;
                case 5:
                    hInM = 25;
                    break;
                case 6:
                    hInM = 30;
                    break;
                case 7:
                    hInM = 35;
                    break;
                case 8:
                    hInM = 40;
                    break;
                case 9:
                    hInM = 45;
                    break;
                case 10:
                    hInM = 50;
                    break;
                case 11:
                    hInM = 55;
                    break;
                case 12:
                    hInM = 0;
                    break;
            }
            return hInM + (int)(minute / 12);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {

#if __debug
            var str = "12 30 45 3 11";
#else
            var str = Console.ReadLine();
#endif

            var h = Convert.ToInt32(str.Split(' ')[0]);
            var m = Convert.ToInt32(str.Split(' ')[1]);
            var s = Convert.ToInt32(str.Split(' ')[2]);

            var t1 = Convert.ToInt32(str.Split(' ')[3]);
            var t2 = Convert.ToInt32(str.Split(' ')[4]);

            Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m), m,s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));
        }

        static string Check(int hm, int mm, int sm, int t1,int t2)
        {
#if __debug
            Console.WriteLine($"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}");
#else

#endif
            //теперь у меня есть шкала 0-60 двунаправленная

            //надо глянуть преграды в 2 стороны между т1 и т2

            //пойдем всегда от меньшего к большему, так проще
            var tmin = t1 > t2 ? t2 : t1;
            var tmax = t1 > t2 ? t1 : t2;

            //пробуем пойти вперед от tmin до tmax ища пустой промежуток
            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }
            //пробуем пойти назад от tmin до 0 и вперед от tmax до 60 ища пустой промежуток
            if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по убыванию до 0 для tmin");
#endif
                if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))
                {
#if __debug
                    Console.WriteLine($"Нет преград по возрастанию до 60 для tmax");
#endif
                    return "YES";
                }
            }

            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }

            return "NO";
        }
    }
}

//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }

        public static decimal ConvertMinuteToMunite(int minute, int second = 0)
        {
            return minute + (decimal)second / 6 / 10;
        }
        public static decimal ConvertHourToMunite(int hour, int minute = 0, int second = 0)
        {
            //12.00-12.11 = 0
            //12.12-12.23 = 1
            //12.24-12.35 = 2
            //12.36-12.47 = 3
            //12.48-12.59 = 4

            int hInM = 5 * hour;
            if (hInM == 60) hInM = 0;
            return hInM + ((decimal) ConvertMinuteToMunite(minute, second) / 12) + ((decimal) second / 6 / 10);
            //return hInM;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {

#if __debug
            var str = "6 59 59 11 12";
#else
            var str = Console.ReadLine();
#endif

            var h = Convert.ToInt32(str.Split(' ')[0]);
            var m = Convert.ToInt32(str.Split(' ')[1]);
            var s = Convert.ToInt32(str.Split(' ')[2]);

            var t1 = Convert.ToInt32(str.Split(' ')[3]);
            var t2 = Convert.ToInt32(str.Split(' ')[4]);

            Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m, s), TestExtensions.ConvertMinuteToMunite(m,s), s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));
        }

        static string Check(decimal hm, decimal mm, decimal sm, decimal t1, decimal t2)
        {
#if __debug
            Console.WriteLine($"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}");
#else

#endif
            //теперь у меня есть шкала 0-60 двунаправленная

            //надо глянуть преграды в 2 стороны между т1 и т2

            //пойдем всегда от меньшего к большему, так проще
            var tmin = t1 > t2 ? t2 : t1;
            var tmax = t1 > t2 ? t1 : t2;

            //пробуем пойти вперед от tmin до tmax ища пустой промежуток
            //if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            if ((tmin > hm || tmax < hm) && (tmin > mm || tmax < mm) && (tmin > sm || tmax < sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }
            //пробуем пойти назад от tmin до 0 и вперед от tmax до 60 ища пустой промежуток
            //if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))
            if (tmin == 0 || (tmin < hm && tmin < mm && tmin < sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по убыванию до 0 для tmin");
#endif
                //if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))
                if (tmax == 60 || (tmax > hm && tmax > mm && tmax > sm))
                {
#if __debug
                    Console.WriteLine($"Нет преград по возрастанию до 60 для tmax");
#endif
                    return "YES";
                }
            }

            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }

            return "NO";
        }
    }
}

//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }

        public static int ConvertHourToMunite(int hour, int minute = 0)
        {
            //12.00-12.11 = 0
            //12.12-12.23 = 1
            //12.24-12.35 = 2
            //12.36-12.47 = 3
            //12.48-12.59 = 4

            int hInM = 5 * hour;
            if (hInM == 60) hInM = 0;
            //return hInM + (int)(minute / 12);
            return hInM;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {

#if __debug
            var str = "3 47 0 4 9";
#else
            var str = Console.ReadLine();
#endif

            var h = Convert.ToInt32(str.Split(' ')[0]);
            var m = Convert.ToInt32(str.Split(' ')[1]);
            var s = Convert.ToInt32(str.Split(' ')[2]);

            var t1 = Convert.ToInt32(str.Split(' ')[3]);
            var t2 = Convert.ToInt32(str.Split(' ')[4]);

            Console.WriteLine(Check(TestExtensions.ConvertHourToMunite(h, m), m,s, TestExtensions.ConvertHourToMunite(t1), TestExtensions.ConvertHourToMunite(t2)));
        }

        static string Check(int hm, int mm, int sm, int t1,int t2)
        {
#if __debug
            Console.WriteLine($"hm={hm} mm={mm} sm={sm} t1={t1} t2={t2}");
#else

#endif
            //теперь у меня есть шкала 0-60 двунаправленная

            //надо глянуть преграды в 2 стороны между т1 и т2

            //пойдем всегда от меньшего к большему, так проще
            var tmin = t1 > t2 ? t2 : t1;
            var tmax = t1 > t2 ? t1 : t2;

            //пробуем пойти вперед от tmin до tmax ища пустой промежуток
            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }
            //пробуем пойти назад от tmin до 0 и вперед от tmax до 60 ища пустой промежуток
            if (tmin == 0 || (tmin <= hm && tmin <= mm && tmin <=sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по убыванию до 0 для tmin");
#endif
                if (tmax == 60 || (tmax >= hm && tmax >= mm && tmax >= sm))
                {
#if __debug
                    Console.WriteLine($"Нет преград по возрастанию до 60 для tmax");
#endif
                    return "YES";
                }
            }

            if ((tmin >= hm || tmax <= hm) && (tmin >= mm || tmax <= mm) && (tmin >= sm || tmax <= sm))
            {
#if __debug
                Console.WriteLine($"Нет преград по возрастанию");
#endif
                return "YES";
            }

            return "NO";
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Numerics;

namespace ConsoleApplication1
{

    class Program
    {

        static TextReader sr;
        static TextWriter sw;

        enum Direction {Vertical, Horizontal }

        static void Main(string[] args)
        {
            if (File.Exists("input.txt"))
            {
                sr = new StreamReader("input.txt");
                sw = new StreamWriter("output.txt");
            }
            else
            {
                sr = Console.In;
                sw = Console.Out;
            }
            Solve();
            if (File.Exists("input.txt"))
            {
                sr.Close();
                sw.Close();
            }
        }

        static void Solve()
        {
            int h = ReadInt() * 5, m = ReadInt(), s = ReadInt(), start = ReadInt() * 5, stop = ReadInt() * 5;
            if (stop < start)
            {
                int temp = stop;
                stop = start;
                start = temp;
            }
            if (start == stop)
            {
                sw.WriteLine("YES");
                return;
            }
            bool f1 = false, f2 = false;
            if ((h > start && h < stop) || (m > start && m < stop) || (s > start && s < stop))
            {
                f1 = true;
            }
            if ((!(h > start && h < stop)) || (!(m > start && m < stop)) || (!(s > start && s < stop)))
            {
                f2 = true;
            }
            if (f1 && f2)
            {
                sw.WriteLine("NO");
            }
            else
            {
                sw.WriteLine("YES");
            }
        }

        static int comparator(Pair<Pair<int, int>, Pair<int, int>> a, Pair<Pair<int, int>, Pair<int, int>> b)
        {
            if (a.first.first == b.first.first)
            {
                if (a.first.second == b.first.second)
                {
                    return a.CompareTo(b);
                }
                else
                {
                    return b.first.second - a.first.second;
                }
            }
            else
            {
                return a.first.first - b.first.first;
            }
        }

        static long ariphmeticsum(long n)
        {
            return n * (n + 1) / 2;
        }

        static bool check()
        {
            return true;
        }

        static long getManhattan(Pair<long, long> a, Pair<long, long> b)
        {
            return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);
        }

        static string[] buffer = new string[0];
        static int counterbuffer = 0;

        static Graph ReadGraph()
        {
            int n = ReadInt();
            int m = ReadInt();
            int[] a = new int[m];
            int[] b = new int[m];
            for (int i = 0; i < m; i++)
            {
                a[i] = ReadInt();
                b[i] = ReadInt();
            }
            return new Graph(n, a, b);
        }

        static Graph<T> ReadGraph<T>(Parser<T> parser)
            where T: IComparable<T>
        {
            int n = ReadInt();
            int m = ReadInt();
            int[] a = new int[m];
            int[] b = new int[m];
            T[] c = new T[m];
            for (int i = 0; i < m; i++)
            {
                a[i] = ReadInt();
                b[i] = ReadInt();
                c[i] = Read<T>(sr, parser);
            }
            return new Graph<T>(n, a, b, c);
        }

        static int[] ReadArrayInt()
        {
            return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static long[] ReadArrayLong()
        {
            return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static int[][] ReadMatrixInt(int n, int m)
        {
            int[][] answer = new int[n][];
            for (int i = 0; i < n; i++)
            {
                answer[i] = new int[m];
                for (int j = 0; j < m; j++)
                {
                    answer[i][j] = ReadInt();
                }
            }
            return answer;
        }

        static long[][] ReadMatrixLong(int n, int m)
        {
            long[][] answer = new long[n][];
            for (int i = 0; i < n; i++)
            {
                answer[i] = new long[m];
                for (int j = 0; j < m; j++)
                {
                    answer[i][j] = ReadLong();
                }
            }
            return answer;
        }

        static BigInteger ReadBigInteger()
        {
            return ReadBigInteger(sr);
        }

        static BigInteger ReadBigInteger(TextReader sr)
        {
            return Read<BigInteger>(sr, BigInteger.Parse);
        }

        static int ReadInt()
        {
            return ReadInt(sr);
        }

        static int ReadInt(TextReader sr)
        {
            return Read<int>(sr, int.Parse);
        }

        static long ReadLong()
        {
            return ReadLong(sr);
        }

        static long ReadLong(TextReader sr)
        {
            return Read<long>(sr, long.Parse);
        }

        static double ReadDouble()
        {
            return ReadDouble(sr);
        }

        static double ReadDouble(TextReader sr)
        {
            return Read<double>(sr, double.Parse);
        }

        static string ReadString()
        {
            return ReadString(sr);
        }

        static string ReadString(TextReader sr)
        {
            return Read<string>(sr, x => x);
        }

        static U Read<U>(TextReader sr, Parser<U> parser)
        {
            if (counterbuffer >= buffer.Length)
            {
                buffer = sr.ReadLine().Split(' ').ToArray();
                while (buffer.Length == 0)
                {
                    buffer = sr.ReadLine().Split(' ').ToArray();
                }
                counterbuffer = 0;
            }
            return parser(buffer[counterbuffer++]);
        }
    }

    public delegate U Parser<U>(string str);

    class Graph
    {
        protected int[][] Edges;
        public int this[int val1, int val2]
        {
            get
            {
                return Edges[val1][val2];
            }
            set
            {
                Edges[val1][val2] = value;
            }
        }

        public Graph(int n, int[] a, int[] b)
        {
            generateEdges(n, a, b);
        }

        private void generateEdges(int n, int[] a, int[] b)
        {
            int[] temp = new int[n];
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] != b[i])
                {
                    temp[a[i] - 1]++;
                    temp[b[i] - 1]++;
                }
                else
                {
                    temp[a[i] - 1]++;
                }
            }
            Edges = new int[n][];
            for (int i = 0; i < n; i++)
            {
                Edges[i] = new int[temp[i]];
            }
            for (int i = 0; i < n; i++)
            {
                temp[i] = 0;
            }
            for (int j = 0; j < a.Length; j++)
            {
                if (a[j] != b[j])
                {
                    Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;
                    Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;
                }
                else
                {
                    Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;
                }
            }
        }

        public override string ToString()
        {
            string answer = "";
            foreach (var i in Edges)
            {
                foreach (var j in i)
                {
                    answer += (j+1) + " ";
                }
                answer += Environment.NewLine;
            }
            return answer;
        }
    }

    class Graph<T> : Graph
        where T: IComparable<T>
    {
        public T[][] Cost;
        public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)
        {
            this.GenerateEdges(n, a, b, c);
        }

        private void GenerateEdges(int n, int[] a, int[] b, T[] c)
        {
            Cost = new T[n][];
            for (int i = 0; i < n; i++)
            {
                Cost[i] = new T[Edges[i].Length];
            }
            int[] temp = new int[n];

            for (int j = 0; j < c.Length; j++)
            {
                if (a[j] != b[j])
                {
                    Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];
                    Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];
                }
                else
                {
                    Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];
                }
            }
        }

        public override string ToString()
        {
            string answer = "";
            for (int i = 0; i < Cost.Length; i++)
            {
                for (int j = 0; j < Cost[i].Length; j++)
                {
                    answer += (i + 1) + " " + (Edges[i][j] + 1) + " " + Cost[i][j] + Environment.NewLine;
                }
            }
            return answer;
        }
    }

    class Pair<U, V> : IComparable<Pair<U, V>>
         where U : IComparable<U> where V : IComparable<V>
    {
        public U first;
        public V second;
        public Pair(U first, V second)
        {
            this.first = first;
            this.second = second;
        }

        public int CompareTo(Pair<U, V> b)
        {
            if (first.CompareTo(b.first) == 0)
            {
                return second.CompareTo(b.second);
            }
            return first.CompareTo(b.first);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.IO;
using System.Numerics;

namespace ConsoleApplication1
{

    class Program
    {

        static TextReader sr;
        static TextWriter sw;

        enum Direction {Vertical, Horizontal }

        static void Main(string[] args)
        {
            if (File.Exists("input.txt"))
            {
                sr = new StreamReader("input.txt");
                sw = new StreamWriter("output.txt");
            }
            else
            {
                sr = Console.In;
                sw = Console.Out;
            }
            Solve();
            if (File.Exists("input.txt"))
            {
                sr.Close();
                sw.Close();
            }
        }

        static void Solve()
        {
            int h = (ReadInt() - 1) * 5, m = ReadInt(), s = ReadInt(), start = (ReadInt() - 1) * 5, stop = (ReadInt() - 1) * 5;
            if (stop < start)
            {
                int temp = stop;
                stop = start;
                start = temp;
            }
            if (start == stop)
            {
                sw.WriteLine("YES");
                return;
            }
            bool f1 = false, f2 = false;
            if ((h > start && h < stop) || (m > start && m < stop) || (s > start && s < stop))
            {
                f1 = true;
            }
            if ((!(h > start && h < stop)) || (!(m > start && m < stop)) || (!(s > start && s < stop)))
            {
                f2 = true;
            }
            if (f1 && f2)
            {
                sw.WriteLine("NO");
            }
            else
            {
                sw.WriteLine("YES");
            }
        }

        static int comparator(Pair<Pair<int, int>, Pair<int, int>> a, Pair<Pair<int, int>, Pair<int, int>> b)
        {
            if (a.first.first == b.first.first)
            {
                if (a.first.second == b.first.second)
                {
                    return a.CompareTo(b);
                }
                else
                {
                    return b.first.second - a.first.second;
                }
            }
            else
            {
                return a.first.first - b.first.first;
            }
        }

        static long ariphmeticsum(long n)
        {
            return n * (n + 1) / 2;
        }

        static bool check()
        {
            return true;
        }

        static long getManhattan(Pair<long, long> a, Pair<long, long> b)
        {
            return Math.Abs(a.first - b.first) + Math.Abs(a.second - b.second);
        }

        static string[] buffer = new string[0];
        static int counterbuffer = 0;

        static Graph ReadGraph()
        {
            int n = ReadInt();
            int m = ReadInt();
            int[] a = new int[m];
            int[] b = new int[m];
            for (int i = 0; i < m; i++)
            {
                a[i] = ReadInt();
                b[i] = ReadInt();
            }
            return new Graph(n, a, b);
        }

        static Graph<T> ReadGraph<T>(Parser<T> parser)
            where T: IComparable<T>
        {
            int n = ReadInt();
            int m = ReadInt();
            int[] a = new int[m];
            int[] b = new int[m];
            T[] c = new T[m];
            for (int i = 0; i < m; i++)
            {
                a[i] = ReadInt();
                b[i] = ReadInt();
                c[i] = Read<T>(sr, parser);
            }
            return new Graph<T>(n, a, b, c);
        }

        static int[] ReadArrayInt()
        {
            return sr.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        static long[] ReadArrayLong()
        {
            return sr.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static int[][] ReadMatrixInt(int n, int m)
        {
            int[][] answer = new int[n][];
            for (int i = 0; i < n; i++)
            {
                answer[i] = new int[m];
                for (int j = 0; j < m; j++)
                {
                    answer[i][j] = ReadInt();
                }
            }
            return answer;
        }

        static long[][] ReadMatrixLong(int n, int m)
        {
            long[][] answer = new long[n][];
            for (int i = 0; i < n; i++)
            {
                answer[i] = new long[m];
                for (int j = 0; j < m; j++)
                {
                    answer[i][j] = ReadLong();
                }
            }
            return answer;
        }

        static BigInteger ReadBigInteger()
        {
            return ReadBigInteger(sr);
        }

        static BigInteger ReadBigInteger(TextReader sr)
        {
            return Read<BigInteger>(sr, BigInteger.Parse);
        }

        static int ReadInt()
        {
            return ReadInt(sr);
        }

        static int ReadInt(TextReader sr)
        {
            return Read<int>(sr, int.Parse);
        }

        static long ReadLong()
        {
            return ReadLong(sr);
        }

        static long ReadLong(TextReader sr)
        {
            return Read<long>(sr, long.Parse);
        }

        static double ReadDouble()
        {
            return ReadDouble(sr);
        }

        static double ReadDouble(TextReader sr)
        {
            return Read<double>(sr, double.Parse);
        }

        static string ReadString()
        {
            return ReadString(sr);
        }

        static string ReadString(TextReader sr)
        {
            return Read<string>(sr, x => x);
        }

        static U Read<U>(TextReader sr, Parser<U> parser)
        {
            if (counterbuffer >= buffer.Length)
            {
                buffer = sr.ReadLine().Split(' ').ToArray();
                while (buffer.Length == 0)
                {
                    buffer = sr.ReadLine().Split(' ').ToArray();
                }
                counterbuffer = 0;
            }
            return parser(buffer[counterbuffer++]);
        }
    }

    public delegate U Parser<U>(string str);

    class Graph
    {
        protected int[][] Edges;
        public int this[int val1, int val2]
        {
            get
            {
                return Edges[val1][val2];
            }
            set
            {
                Edges[val1][val2] = value;
            }
        }

        public Graph(int n, int[] a, int[] b)
        {
            generateEdges(n, a, b);
        }

        private void generateEdges(int n, int[] a, int[] b)
        {
            int[] temp = new int[n];
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] != b[i])
                {
                    temp[a[i] - 1]++;
                    temp[b[i] - 1]++;
                }
                else
                {
                    temp[a[i] - 1]++;
                }
            }
            Edges = new int[n][];
            for (int i = 0; i < n; i++)
            {
                Edges[i] = new int[temp[i]];
            }
            for (int i = 0; i < n; i++)
            {
                temp[i] = 0;
            }
            for (int j = 0; j < a.Length; j++)
            {
                if (a[j] != b[j])
                {
                    Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;
                    Edges[b[j] - 1][temp[b[j] - 1]++] = a[j] - 1;
                }
                else
                {
                    Edges[a[j] - 1][temp[a[j] - 1]++] = b[j] - 1;
                }
            }
        }

        public override string ToString()
        {
            string answer = "";
            foreach (var i in Edges)
            {
                foreach (var j in i)
                {
                    answer += (j+1) + " ";
                }
                answer += Environment.NewLine;
            }
            return answer;
        }
    }

    class Graph<T> : Graph
        where T: IComparable<T>
    {
        public T[][] Cost;
        public Graph(int n, int[] a, int[] b, T[] c): base(n, a, b)
        {
            this.GenerateEdges(n, a, b, c);
        }

        private void GenerateEdges(int n, int[] a, int[] b, T[] c)
        {
            Cost = new T[n][];
            for (int i = 0; i < n; i++)
            {
                Cost[i] = new T[Edges[i].Length];
            }
            int[] temp = new int[n];

            for (int j = 0; j < c.Length; j++)
            {
                if (a[j] != b[j])
                {
                    Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];
                    Cost[b[j] - 1][temp[b[j] - 1]++] = c[j];
                }
                else
                {
                    Cost[a[j] - 1][temp[a[j] - 1]++] = c[j];
                }
            }
        }

        public override string ToString()
        {
            string answer = "";
            for (int i = 0; i < Cost.Length; i++)
            {
                for (int j = 0; j < Cost[i].Length; j++)
                {
                    answer += (i + 1) + " " + (Edges[i][j] + 1) + " " + Cost[i][j] + Environment.NewLine;
                }
            }
            return answer;
        }
    }

    class Pair<U, V> : IComparable<Pair<U, V>>
         where U : IComparable<U> where V : IComparable<V>
    {
        public U first;
        public V second;
        public Pair(U first, V second)
        {
            this.first = first;
            this.second = second;
        }

        public int CompareTo(Pair<U, V> b)
        {
            if (first.CompareTo(b.first) == 0)
            {
                return second.CompareTo(b.second);
            }
            return first.CompareTo(b.first);
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Race_Against_Time
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve() ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve()
        {
            int h = Next() % 12, m = Next(), s = Next(), t1 = Next() % 12, t2 = Next() % 12;

            if (t1 > t2)
            {
                int t = t1;
                t1 = t2;
                t2 = t;
            }

            double hd = m > 0 || s > 0 ? h + 0.1 : h;
            double md = s > 0 ? m*12/60 + 0.1 : m*12/60;
            double sd = s*12/60;

            bool hb = hd > t1 && hd < t2;
            bool mb = md > t1 && md < t2;
            bool sb = sd > t1 && sd < t2;

            return (hb && mb && sb) || (!hb && !mb && !sb);
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Race_Against_Time
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve() ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve()
        {
            int h = Next(), m = Next(), s = Next(), t1 = Next(), t2 = Next();

            if (t1 > t2)
            {
                int t = t1;
                t1 = t2;
                t2 = t;
            }

            double hd = m > 0 || s > 0 ? h + 0.1 : h;
            double md = s > 0 ? m*12/60 + 0.1 : m*12/60;
            double sd = s*12/60;

            bool hb = hd > t1 && hd < t2;
            bool mb = md > t1 && md < t2;
            bool sb = sd > t1 && sd < t2;

            return (hb && mb && sb) || (!hb && !mb && !sb);
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace _438b
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION

            var d = readIntArray();
            var h = d[0];
            var m = d[1];
            var s = d[2];
            var t1 = d[3];
            var t2 = d[4];

            var count = 60 * 60;
            var inm = count / 5;
            var ins = inm / 60;

            var hs = (h * count + m * 60 + s) % (12 * count);
            var ms = m * inm + s * ins;
            var ss = s;

            var hm = hs;
            var t1m = (t1 * count) % (12 * count);
            var t2m = (t2 * count) % (12 * count);
            var all = new int[] { hs, ms, ss };
            //var hc = (5L / 60L) / 60L;

            if (t1m > t2m)
            {
                if (!all.Any(t => t < t1m && t > t2m))
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (!all.Any(t => t > t1m || t < t2m || t == 0))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            else
            {
                if (!all.Any(t => t > t1m && t < t2m))
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (!all.Any(t => t < t1m || t > t2m || t == 0))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }

            Console.WriteLine("NO");
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        //static Tuple hToM(int h, int m, int s)
        //{

        //    return (h * 5) % 60;
        //}

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}

#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace _438b
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION

            var d = readIntArray();
            var h = d[0];
            var m = d[1];
            var s = d[2];
            var t1 = d[3];
            var t2 = d[4];

            var hm = hToM(h);
            var t1m = hToM(t1);
            var t2m = hToM(t2);
            var all = new int[] { hm, m, s };

            if (t1m > t2m)
            {
                if (!all.Any(t => t < t1m && t > t2m))
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (!all.Any(t => t > t1m || t < t2m || t == 0))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            else
            {
                if (!all.Any(t => t > t1m && t < t2m))
                {
                    Console.WriteLine("YES");
                    return;
                }

                if (!all.Any(t => t < t1m || t > t2m || t == 0))
                {
                    Console.WriteLine("YES");
                    return;
                }
            }

            Console.WriteLine("NO");
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int hToM(int h)
        {
            return (h * 5) % 60;
        }

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 5;
        int m = fl[1];
        int s = fl[2];
        int t1 = fl[3] * 5;
        int t2 = fl[4] * 5;

        if (h == 60){
            h = 0;
        }
        if (t1 == 60){
            t1 = 0;
        }
        if (t2 == 60){
            t2 = 0;
        }

        if (t1 > t2)
        {
            var t = t1;
            t1 = t2;
            t2 = t;
        }

        if ((h < t1 || h >= t2) && (m < t1 || m > t2) && (s < t1 || s >= t2))
        {
            Console.WriteLine("YES");
            return;
        }

        bool backwords = false;
        bool forwards = false;

        if (t1 <= h && t1 <= m && t1 <= s)
        {
            backwords = true;
        }

        if (t2 >= h && t2 >= m && t2 >= s)
        {
            forwards = true;
        }

        if (backwords && forwards)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = ConvertRange(1, 12, 0, 59, fl[0]);
        int m = fl[1];
        int s = fl[2];
        int t1 = ConvertRange(1, 12, 0, 59, fl[3]);
        int t2 = ConvertRange(1, 12, 0, 59, fl[4]);

        int p;
        if (t1 < 59)
        {
            p = t1 + 1;
        }
        else
        {
            p = 0;
        }

        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p < 59)
            {
                p++;
            }
            else
            {
                p = 0;
            }
        }

        p = t1 - 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p > 1)
            {
                p--;
            }
            else
            {
                p = 43200;
            }
        }

        Console.WriteLine("NO");
    }

    public static int ConvertRange(
        int originalStart, int originalEnd, // original range
        int newStart, int newEnd, // desired range
        int value) // value to convert
    {
        double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
        return (int)(newStart + ((value - originalStart) * scale));
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 5;
        int m = fl[1];
        int s = fl[2];
        int t1 = fl[3] * 5;
        int t2 = fl[4] * 5;

        if (h == 60){
            h = 0;
        }
        if (t1 == 60){
            t1 = 0;
        }
        if (t2 == 60){
            t2 = 0;
        }

        if (t1 > t2)
        {
            var t = t1;
            t1 = t2;
            t2 = t;
        }

        if ((h < t1 || h >= t2) && (m < t1 || m > t2) && (s < t1 || s >= t2))
        {
            Console.WriteLine("YES");
            return;
        }

        bool backwords = false;
        bool forwards = false;

        if (t1 <= h && t1 <= m && t1 <= s)
        {
            backwords = true;
        }

        if (t1 >= h && t2 >= m && t2 >= s)
        {
            forwards = true;
        }

        if (backwords && forwards)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = ConvertRange(1, 12, 0, 59, fl[0]);
        int m = fl[1];
        int s = fl[2];
        int t1 = ConvertRange(1, 12, 0, 59, fl[3]);
        int t2 = ConvertRange(1, 12, 0, 59, fl[4]);

        int p;
        if (t1 < 59)
        {
            p = t1 + 1;
        }
        else
        {
            p = 0;
        }

        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s && (t1 != h || t1 != m || t1 != s))
            {
                break;
            }
            if (p < 59)
            {
                p++;
            }
            else
            {
                p = 0;
            }
        }

        p = t1 - 1;
        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s && (t1 != h || t1 != m || t1 != s))
            {
                break;
            }
            if (p > 0)
            {
                p--;
            }
            else
            {
                p = 59;
            }
        }

        Console.WriteLine("NO");
    }

    public static int ConvertRange(
        int originalStart, int originalEnd, // original range
        int newStart, int newEnd, // desired range
        int value) // value to convert
    {
        double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
        return (int)(newStart + ((value - originalStart) * scale));
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 5;
        int m = fl[1];
        int s = fl[2];
        int t1 = fl[3] * 5;
        int t2 = fl[4] * 5;

        if (h == 60){
            h = 0;
        }
        if (t1 == 60){
            t1 = 0;
        }
        if (t2 == 60){
            t2 = 0;
        }

        if (t1 > t2)
        {
            var t = t1;
            t1 = t2;
            t2 = t;
        }

        if ((h <= t1 || h >= t2) && (m <= t1 || m >= t2) && (s <= t1 || s >= t2))
        {
            Console.WriteLine("YES");
            return;
        }

        bool backwords = false;
        bool forwards = false;

        if (t1 <= h && t1 <= m && t1 <= s)
        {
            backwords = true;
        }

        if (t1 >= h && t2 >= m && t2 >= s)
        {
            forwards = true;
        }

        if (backwords && forwards)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = ConvertRange(1, 12, 0, 59, fl[0]);
        int m = fl[1];
        int s = fl[2];
        int t1 = ConvertRange(1, 12, 0, 59, fl[3]);
        int t2 = ConvertRange(1, 12, 0, 59, fl[4]);

        int p = t1 + 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p < 43200)
            {
                p++;
            }
            else
            {
                p = 1;
            }
        }

        p = t1 - 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p > 1)
            {
                p--;
            }
            else
            {
                p = 43200;
            }
        }

        Console.WriteLine("NO");
    }

    public static int ConvertRange(
        int originalStart, int originalEnd, // original range
        int newStart, int newEnd, // desired range
        int value) // value to convert
    {
        double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
        return (int)(newStart + ((value - originalStart) * scale));
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = ConvertRange(1, 12, 0, 59, fl[0]);
        int m = fl[1];
        int s = fl[2];
        int t1 = ConvertRange(1, 12, 0, 59, fl[3]);
        int t2 = ConvertRange(1, 12, 0, 59, fl[4]);

        int p = t1 + 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p < 60)
            {
                p++;
            }
            else
            {
                p = 1;
            }
        }

        p = t1 - 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p > 1)
            {
                p--;
            }
            else
            {
                p = 43200;
            }
        }

        Console.WriteLine("NO");
    }

    public static int ConvertRange(
        int originalStart, int originalEnd, // original range
        int newStart, int newEnd, // desired range
        int value) // value to convert
    {
        double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
        return (int)(newStart + ((value - originalStart) * scale));
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 60 * 60;
        int m = fl[1];
        int s = fl[2];
        int t1 = fl[3] * 60 * 60;
        int t2 = fl[4] * 60 * 60;

        var barrier = h + m + s;

        if (t1 > t2)
        {
            var t = t1;
            t1 = t2;
            t2 = t;
        }

        if (barrier < t1 || barrier > t2)
        {
            Console.WriteLine("YES");
            return;
        }

        bool backwords = false;
        bool forwards = false;

        if (t1 < barrier)
        {
            backwords = true;
        }

        if (t2 > barrier)
        {
            forwards = true;
        }

        if (backwords && forwards)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 60 * 60;
        int m = fl[1] * 60;
        int s = fl[2];
        int t1 = fl[3] * 60 * 60;
        int t2 = fl[4] * 60 * 60;

        int p = t1 + 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p < 43200)
            {
                p++;
            }
            else
            {
                p = 1;
            }
        }

        p = t1 - 1;
        while (p != t1)
        {
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p > 1)
            {
                p--;
            }
            else
            {
                p = 43200;
            }
        }

        Console.WriteLine("NO");
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = ConvertRange(1, 12, 0, 59, fl[0]);
        int m = fl[1];
        int s = fl[2];
        int t1 = ConvertRange(1, 12, 0, 59, fl[3]);
        int t2 = ConvertRange(1, 12, 0, 59, fl[4]);

        int p;
        if (t1 < 59)
        {
            p = t1 + 1;
        }
        else
        {
            p = 0;
        }

        if (t1 == h || t1 == m || t1 == s){
            Console.WriteLine("NO");
            return;
        }

        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p < 59)
            {
                p++;
            }
            else
            {
                p = 0;
            }
        }

        if (t1 > 0)
        {
            p = t1 - 1;
        }
        else
        {
            p = 59;
        }
        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s)
            {
                break;
            }
            if (p > 0)
            {
                p--;
            }
            else
            {
                p = 59;
            }
        }

        Console.WriteLine("NO");
    }

    public static int ConvertRange(
        int originalStart, int originalEnd, // original range
        int newStart, int newEnd, // desired range
        int value) // value to convert
    {
        double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
        return (int)(newStart + ((value - originalStart) * scale));
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = ConvertRange(1, 12, 0, 59, fl[0]);
        int m = fl[1];
        int s = fl[2];
        int t1 = ConvertRange(1, 12, 0, 59, fl[3]);
        int t2 = ConvertRange(1, 12, 0, 59, fl[4]);

        int p;
        if (t1 < 59)
        {
            p = t1 + 1;
        }
        else
        {
            p = 0;
        }

        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s || t1 != h || t1 != m || t1 != s)
            {
                break;
            }
            if (p < 59)
            {
                p++;
            }
            else
            {
                p = 0;
            }
        }

        p = t1 - 1;
        while (p != t1)
        {
            if (p == t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (p == h || p == m || p == s || t1 != h || t1 != m || t1 != s)
            {
                break;
            }
            if (p > 0)
            {
                p--;
            }
            else
            {
                p = 59;
            }
        }

        Console.WriteLine("NO");
    }

    public static int ConvertRange(
        int originalStart, int originalEnd, // original range
        int newStart, int newEnd, // desired range
        int value) // value to convert
    {
        double scale = (double)(newEnd - newStart) / (originalEnd - originalStart);
        return (int)(newStart + ((value - originalStart) * scale));
    }
}

using System;
using System.Linq;

class MainClass
{
    public static void Main(string[] args)
    {
        var fl = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int h = fl[0] * 5;
        int m = fl[1];
        int s = fl[2];
        int t1 = fl[3] * 5;
        int t2 = fl[4] * 5;

        if (h == 60){
            h = 0;
        }
        if (t1 == 60){
            t1 = 0;
        }
        if (t2 == 60){
            t2 = 0;
        }

        if (t1 > t2)
        {
            var t = t1;
            t1 = t2;
            t2 = t;
        }

        if ((h < t1 || h >= t2) && (m < t1 || m > t2) && (s < t1 || s >= t2))
        {
            Console.WriteLine("YES");
            return;
        }

        bool backwords = false;
        bool forwards = false;

        if (t1 < h && t1 < m && t1 < s)
        {
            backwords = true;
        }

        if (t2 > h && t2 > m && t2 > s)
        {
            forwards = true;
        }

        if (backwords && forwards)
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            List<double> l = new List<double>();
            List<double> ll = new List<double>();
            foreach (var b in a)
            {
                var c = double.Parse(b);
                l.Add(c);
            }
            l[0] = (1.0 * l[0] - 1 + l[1] / 60 + l[2] / 3600) * 60;
            l[1] = l[1] + l[2] / 60;
            var t1 = l[3] * 60;
            var t2 = l[3] * 60;
            for(int i = 0; i < 3; i++)
            {
                ll.Add(l[i]);
            }
            ll.Sort();

            var llmx = ll.Max();
            var llmn = ll.Min();
            if (llmx < t1 && llmx < t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (llmn > t1 && llmn > t2)
            {

                Console.WriteLine("YES");
                return;
            }

            //

            if (ll[0] < t1 && ll[1] > t1 && ll[0] < t2 && ll[1] > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            if (ll[1] < t1 && ll[2] > t1 && ll[1] < t2 && ll[2] > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            //
            if (t1 > t2)
            {
                Swap(ref t1,ref t2);
            }
            if (t2 > llmx && t1 < llmn)
            {

                Console.WriteLine("YES");
                return;
            }
            Console.WriteLine("NO");

            }
        public static void Swap<T>(ref T lhs, ref T rhs)
        {
            T temp = lhs;
            lhs = rhs;
            rhs = temp;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(' ');
            List<double> l = new List<double>();
            List<double> ll = new List<double>();
            foreach (var b in a)
            {
                var c = double.Parse(b);
                l.Add(c);
            }
            l[0] = (1.0 * l[0] - 1 + l[1] / 60 + l[2] / 3600) * 60;
            l[1] = l[1] + l[2] / 60;
            var t1 = l[3] * 60;
            var t2 = l[3] * 60;
            for(int i = 0; i < 3; i++)
            {
                ll.Add(l[i]);
            }
            var llmx = ll.Max();
            var llmn = ll.Min();
            if (llmx < t1 && llmx < t2)
            {
                Console.WriteLine("YES");
                return;
            }
            if (llmn > t1 && llmn > t2)
            {

                Console.WriteLine("YES");
                return;
            }
            if (t1 > t2)
            {
                Swap(ref t1,ref t2);
            }
            if (t2 > llmx && t1 < llmn)
            {

                Console.WriteLine("YES");
                return;
            }
            Console.WriteLine("NO");

        }
        public static void Swap<T>(ref T lhs, ref T rhs)
        {
            T temp = lhs;
            lhs = rhs;
            rhs = temp;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class ADiv2
   {
      static void Main(string[] args)
      {
          string[] token  = Console.ReadLine().Split();
          int h = int.Parse(token[0]);
          int m = int.Parse(token[1]);
          int s = int.Parse(token[2]);
          int t1 = int.Parse(token[3]);
          int t2 = int.Parse(token[4]);

          h = ((h*5) + (m/12))%60;
          t1 = (t1*5)%60;
          t2 = (t2*5)%60;

          bool val1 = true;int ss = 0;

          for(int i=t1+1;ss<60;i+=1,ss++){
             if(i==60)i=0;
             if(i==h||i==m||i==s){
               val1 = false;
               break;
             }else if(i==t2){
               break;
             }
          }

          bool val2 = true;int vv = 0;
          for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){
             if(i==h||i==m||i==s){
              val2 = false;
              break;
             }else if(i==t2){
               break;
             }
              if(i==0)i=60;
          }
          if(val1){
          Console.WriteLine("YES");
          }else if(val2){
            Console.WriteLine("YES");
          }else{
            Console.WriteLine("NO");
          }

      }
   }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    class B
    {
        static void Main(string[] args)
        {
              string[] token  = Console.ReadLine().Split();
            int h = int.Parse(token[0]);
            int m = int.Parse(token[1]);
            int s = int.Parse(token[2]);
            int t1 = int.Parse(token[3]);
            int t2 = int.Parse(token[4]);
            m = (m==0)?m=60:m;
            s = (s==0)?s=60:s;

            m = m/5;
            s = s/5;

            string ans = "NO";
            for(int i=t1+1;i<24;i++)
            {
               if(i==12)
               {i=0;}

               if(i==t2)
               {
                  Console.WriteLine("YES");
                  return;
               }
                if(i==h||i==m||i==s)
               {
                  break;
               }

            }

             for(int i=t1-1;i<24;i--)
             {
                if(i==0)
               {i=12;}

               if(i==t2)
               {
                  Console.WriteLine("YES");
                  return;
               }
              if(i==h||i==m||i==s)
               {
                  break;
               }
            }
            Console.WriteLine(ans);
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class ADiv2
   {
      static void Main(string[] args)
      {
          string[] token  = Console.ReadLine().Split();
          int h = int.Parse(token[0]);
          int m = int.Parse(token[1]);
          int s = int.Parse(token[2]);
          int t1 = int.Parse(token[3]);
          int t2 = int.Parse(token[4]);

          h = ((h*5) + (m/12))%60;
          t1 = (t1*5)%60;
          t2 = (t2*5)%60;

          bool val1 = true;int ss = 0;

          for(int i=t1+1;ss<60;i+=1,ss++){
             if(i==60)i=0;
             if(i==t2){
               break;
             }
             else if(i==h||i==m||i==s){
               val1 = false;
               break;
             }
          }

          bool val2 = true;int vv = 0;
          for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){
             if(i==t2){
               break;
             }else if(i==h||i==m||i==s){
              val2 = false;
              break;
             }
              if(i==0)i=60;
          }
          if(val1){
          Console.WriteLine("YES");
          }else if(val2){
            Console.WriteLine("YES");
          }else{
            Console.WriteLine("NO");
          }

      }
   }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class ADiv2
   {
      static void Main(string[] args)
      {
          string[] token  = Console.ReadLine().Split();
          int h = int.Parse(token[0]);
          int m = int.Parse(token[1]);
          int s = int.Parse(token[2]);
          int t1 = int.Parse(token[3]);
          int t2 = int.Parse(token[4]);

          h = ((h*5) + (m/12))%60;
          t1 = (t1*5)%60;
          t2 = (t2*5)%60;

          bool val1 = true;int ss = 0;

          for(int i=t1+1;ss<60;i+=1,ss++){
             if(i==60)i=0;
             if(i==t2){
              // Console.WriteLine(i);
               break;
             }else if(i==h||i==m||i==s){
               val1 = false;
               break;
             }
          }

          bool val2 = true;int vv = 0;
          for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){
             if(i==h||i==m||i==s){
              val2 = false;
              break;
             }else if(i==t2){
               break;
             }
              if(i==0)i=60;
          }
          if(val1){
          Console.WriteLine("YES");
          }else if(val2){
            Console.WriteLine("YES");
          }else{
            Console.WriteLine("NO");
          }

      }
   }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
   class ADiv2
   {
      static void Main(string[] args)
      {
          string[] token  = Console.ReadLine().Split();
          int h = int.Parse(token[0]);
          int m = int.Parse(token[1]);
          int s = int.Parse(token[2]);
          int t1 = int.Parse(token[3]);
          int t2 = int.Parse(token[4]);

          h = ((h*5) + (m/12))%60;
          t1 = (t1*5)%60;
          t2 = (t2*5)%60;

          bool val1 = true;int ss = 0;

          for(int i=t1+1;ss<60;i+=1,ss++){
             if(i==60)i=0;
             if(i==h||i==m||i==s){
               val1 = false;
               break;
             }else if(i==t2){
               break;
             }
          }

          bool val2 = true;int vv = 0;
          for(int i=(t1==0)?59:t1-1;vv<60;i-=1,vv++){
             if(i==0)i=60;
             if(i==h||i==m||i==s){
              val2 = false;
              break;
             }else if(i==t2){
               break;
             }
          }
          if(val1){
           Console.WriteLine("YES");
          }else if(val2){
            Console.WriteLine("YES");
          }else{
            Console.WriteLine("NO");
          }

      }
   }

}