from typing import Tuple
from typing import List


def get_words_supertags(line: str) -> Tuple[List[str], List[str]]:
    """
    Takes as input a CCGbank file line and returns two lists of strings, one containing each word in the sentence
    and the other containing the CCG lexical categories for the words.
    """
    terminal_open_bracket = False
    terminals = []
    terminal = ""
    for char in line:
        if char == '<':
            terminal_open_bracket = True
            terminal = ""
        elif char == '>':
            terminal_open_bracket = False
            if len(terminal.strip().split()) == 6:
                terminals.append(terminal.strip())
        elif terminal_open_bracket:
            terminal+=char
    words = [terminal.split()[4] for terminal in terminals]
    ccg_supertags = [terminal.split()[1] for terminal in terminals]
    return words, ccg_supertags