#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAXN 100005

typedef struct Edge {
    int to;
    struct Edge* next;
} Edge;

Edge* adj[MAXN];
int state[MAXN]; // 0 = unvisited, 1 = visiting, 2 = finished
int n, e;
bool hasCycle = false;

// Add directed edge u -> v (overwrite handled externally)
void addEdge(int u, int v) {
    Edge* edge = (Edge*)malloc(sizeof(Edge));
    edge->to = v;
    edge->next = adj[u];
    adj[u] = edge;
}

void dfs(int u) {
    if (hasCycle) return; // stop early if found
    state[u] = 1; // visiting

    for (Edge* p = adj[u]; p != NULL; p = p->next) {
        int v = p->to;
        if (state[v] == 0) {
            dfs(v);
        } else if (state[v] == 1) {
            // Found back edge → cycle
            hasCycle = true;
            return;
        }
    }

    state[u] = 2; // finished
}

int main() {
    if (scanf("%d %d", &n, &e) != 2) return 0;

    if (n < 1 || n > 100000 || e < 0 || e > 200000) {
        printf("Invalid input\n");
        return 0;
    }

   
    int* last = (int*)malloc(sizeof(int) * n * n); // not possible (too big)
    
    int* U = (int*)malloc(sizeof(int) * e);
    int* V = (int*)malloc(sizeof(int) * e);
    int* W = (int*)malloc(sizeof(int) * e);
    for (int i = 0; i < e; i++) {
        scanf("%d %d %d", &U[i], &V[i], &W[i]);
    }

    
    bool* seen = (bool*)calloc(e, sizeof(bool));
    .
    int* mark = (int*)malloc(sizeof(int) * (n*2+5));
    
    bool* keep = (bool*)calloc(e, sizeof(bool));
    int* used = (int*)calloc(n*n, sizeof(int)); // Not possible: n=1e5
    

    for (int i = 0; i < e; i++) {
        int u = U[i], v = V[i];
        if (u < 0 || u >= n || v < 0 || v >= n) {
            printf("Invalid input\n");
            return 0;
        }
        addEdge(u, v);
    }

    // DFS across all nodes
    for (int i = 0; i < n; i++) {
        if (state[i] == 0) dfs(i);
        if (hasCycle) break;
    }

    if (hasCycle) {
        printf("Temporal Collapse\n");
    } else {
        printf("Timeline Stable\n");
    }

    return 0;
}