text: // Challenge url: https://www.hackerrank.com/challenges/the-time-in-words/problem
  
  const timeInWords = (hour, minute) => {
    switch (minute) {
      case 0:
        return `${say(hour)} o' clock`;
      case 1:
        return `one minute past ${say(hour)}`;
      case 15:
        return `quarter past ${say(hour)}`;
      case 30:
        return `half past ${say(hour)}`;
      case 45:
        return `quarter to ${say((hour + 1) % 12)}`;
      case 59:
        return `one minute to ${say((hour + 1) % 12)}`;
      default:
        return minute <= 30
          ? `${say(minute)} minutes past ${say(hour)}`
          : `${say(60 - minute)} minutes to ${say((hour + 1) % 12)}`;
    }
  };
  
  const say = num => {
    switch (num) {
      case 1:
        return "one"
      case 2:
        return "two"
      case 3:
        return "three"
      case 4:
        return "four"
      case 5:
        return "five"
      case 6:
        return "six"
      case 7:
        return "seven"
      case 8:
        return "eight"
      case 9:
        return "nine"
      case 10:
        return "ten"
      case 11:
        return "eleven"
      case 12:
        return "twelve"
      case 13:
        return "thirteen"
      case 14:
        return "fourteen"
      case 15:
        return "fifteen"
      case 16:
        return "sixteen"
      case 17:
        return "seventeen"
      case 18:
        return "eighteen"
      case 19:
        return "nineteen"
      case 20:
        return "twenty"
      default:
        return `twenty ${say(num % 10)}`;
    }
  };
  
  // Main
  
  let input = '';
  let currentLine = 0;
  const readLine = () => input[currentLine++];
  
  process.stdin.on('data', inputStdin => {
    input += inputStdin;
  });
  
  process.stdin.on('end', () => {
    input = input.split('\n');
    console.log(timeInWords(+readLine(), +readLine()));
  });
  