Spreadsheet circular reference
Your task
A spreadsheet engine refuses to recalculate a sheet that holds a circular reference. It hands you links, where each entry is a string like "C4>A1", meaning the formula in cell C4 reads the value in cell A1. Every cell named on either side of a > belongs to the sheet, and a cell that is never named on the left has no formula of its own. Return true when following those reads can arrive back at the cell the chain started from, and false when every chain of reads ends at a cell with no formula. A formula that reads its own cell is circular. The same read may be listed more than once, and the sheet may hold several independent groups of formulas.
Examples
circular_formula_exists(links: list[str]) -> boolExample 1
Input
circular_formula_exists(["C4>A1", "C4>B2"])Output
FalseExample 2
Input
circular_formula_exists(["A1>B1", "B1>C1", "C1>A1"])Output
TrueExample 3
Input
circular_formula_exists(["A1>A1"])Output
True