System: affiche juste le code, pas d'explications !
User: 
Tu es un développeur python3 expérimenté, et tu dois concevoir un programme en python (avec des commentaires en français, sans utiliser de librairies externes, sans `if __name__=="__main__":`, avec type hints, et en privilégiant les algorythmes a complexité constante (O(1)) et/ou complexité linéaire (O(n))).
Le programme va recevoir les données en entrée sur la stdin, et doit répondre sur la stdout.
Fabrique moi un programme python qui résout le problème (énoncé en markdown) suivant :
-----------------------------------------------------
# Time clues

Everyone in the Brigade knows that you are one of the most brilliant agents in the ranks. So much so that you've been put in charge of the Chrono-Alliance investigation: this gang of meta-humans is terrorizing the City and managing to blur the visions of the Brigade's agents by adding temporal traces.

Until now, no one seemed to be able to find any clues about them, but you think you have a lead: the traces they leave seem to create impossible temporal states. From the clues you find at their crime scenes, you notice that at some point the list of clues can no longer correspond to a possible reality. 

The states are represented by 5 lights, which can be of 3 colors (red R, green V or blue B). The clues you find are fuzzy: they give you 3 conditions of which at least one is true but not necessarily all. For example, the clue `R1 B2 V2` tells you that the first light is red, or that the second light is blue, or that the second light is green.

You look at the clues in order: first you look to see if a state of the 5 lights is possible with the first clue. If so, you look for whether a state is possible with the first AND the second clue, and so on until you find the first clue which, if taken into account, makes it impossible 

Write a program that takes as input a list of clues, and returns the maximum index from which there is always a possible state. 

## Data

### Input

**Line 1** : the number `N` of clues, with `8 ≤ N ≤ 30`
**Lines 2 to N+1**: the list of clues in the format with 3 conditions separated by spaces, each condition represented by a color on a letter (R, V or B), and an integer between 1 and 5 giving the number of the indicator. Please note green is noted `V` (and not G).

For example, the index `R1 B2 V2` tells you that the first light is red, or that the second light is blue, or that the second light is green.

### Output

An integer representing the maximum number of clues in a row that can represent a state of the 5 lights.

Note: if a combination of lights exists that satisfies all the clues, your program should return `N`.

## Examples

```
8
R5 R3 R1
B1 V5 V5
B3 R5 B3
V1 V1 B4
V4 V1 R4
V1 R5 V3
R2 B1 R2
R3 B3 R4
```

The combination `BVVBR` satisfies the first 4 conditions. Indeed :
- `R5` is satisfied for the first index
- `B1` for the second
- `R5` for the third
- `B4` for the fourth

On the other hand, there is no combination satisfying the first 5 clues. Your program will have to return `4`.
Assistant: '''python
from typing import List, Tuple

def est_possible(clues: List[Tuple[str, int]], index: int) -> bool:
    # Crée un tableau pour suivre les états possibles des lumières
    etats_possibles = [set() for _ in range(5)]
    
    # Remplit les états possibles en fonction des indices des indices
    for i in range(index + 1):
        for condition in clues[i]:
            couleur, numero = condition[0], int(condition[1]) - 1
            etats_possibles[numero].add(couleur)
    
    # Vérifie si chaque lumière a au moins une couleur possible
    for etat in etats_possibles:
        if not etat:
            return False
    return True

def maximum_index_possible(clues: List[str]) -> int:
    # Convertit les indices de lumière en tuples de conditions
    conditions = [tuple(clue.split()) for clue in clues]
    
    # Recherche le maximum d'indices possibles
    for i in range(len(conditions)):
        if not est_possible(conditions, i):
            return i  # Retourne l'indice maximum où c'est encore possible
    return len(conditions)  # Si toutes les conditions sont possibles

# Lecture des données d'entrée
import sys
input = sys.stdin.read
data = input().strip().splitlines()

N = int(data[0])  # Nombre de pistes
clues = data[1:N + 1]  # Liste des indices

# Affichage du résultat
print(maximum_index_possible(clues))'''
User: Avec l'input:
```8
R5 R3 R1
B1 V5 V5
B3 R5 B3
V1 V1 B4
V4 V1 R4
V1 R5 V3
R2 B1 R2
R3 B3 R4```
Je m'attendais à obtenir:
```4```
Mais j'ai obtenu:
```0```, ce qui n'est pas le résultat attendu !
Assistant: '''python
from typing import List, Tuple

def est_possible(clues: List[Tuple[str, int]], index: int) -> bool:
    etats_possibles = [set() for _ in range(5)]
    
    for i in range(index + 1):
        for condition in clues[i]:
            couleur, numero = condition[0], int(condition[1]) - 1
            etats_possibles[numero].add(couleur)
    
    for etat in etats_possibles:
        if not etat:
            return False
    return True

def maximum_index_possible(clues: List[str]) -> int:
    conditions = [tuple(clue.split()) for clue in clues]
    
    for i in range(len(conditions)):
        if not est_possible(conditions, i):
            return i  # Retourne l'indice maximum où c'est encore possible
    return len(conditions)  # Si toutes les conditions sont possibles

# Lecture des données d'entrée
import sys
input = sys.stdin.read
data = input().strip().splitlines()

N = int(data[0])  # Nombre de pistes
clues = data[1:N + 1]  # Liste des indices

# Affichage du résultat
print(maximum_index_possible(clues))'''
User: Avec l'input:
```8
R5 R3 R1
B1 V5 V5
B3 R5 B3
V1 V1 B4
V4 V1 R4
V1 R5 V3
R2 B1 R2
R3 B3 R4```
Je m'attendais à obtenir:
```4```
Mais j'ai obtenu:
```0```, ce qui n'est pas le résultat attendu !
Assistant: