"I'm tired of seeing the same scenery in the world." --- Philosopher Pang
Pang's world can be simplified as a directed graph G with n vertices and m edges.
A path in G is an ordered list of vertices (v_0,…,v_t−1) for some non-negative integer t such that v_iv_i+1 is an edge in G for all 0≤i\<t−1. A path can be empty in this problem.
A cycle in G is an ordered list of distinct vertices (v_0,…,v_t−1) for some positive integer t≥2 such that v_iv_(i+1)modt is an edge in G for all 0≤i\<t. All circular shifts of a cycle are considered the same.
G satisfies the following property: Every vertex is in at most one cycle.
Given a fixed integer k, count the number of pairs (P_1,P_2) modulo 998244353 such that
The first line contains 3 integers n, m and k (1≤n≤2000,0≤m≤4000,0≤k≤1000000000).
Each of the next m lines contains two integers a and b, denoting an edge from vertex a to b (1≤a,b≤n,a=b).
No two edges connect the same pair of vertices in the same direction.
Output one integer --- the number of pairs (P_1,P_2) modulo 998244353.