Under construction

Still being built. Things may change

Sharing Past Exam Notes

Time limit8sMemory limit1024 MB

Summary
Find the expected number of subjects student 1 holds after K random edge-sharing events on a friendship graph, modulo 998244353.
Level

Medium6 of 10

Topics
Dynamic programming, Probability, Bit manipulation
Solved
No attempts yet

Problem

At the JAG University ICPC department, there are NN students, numbered from 1 to NN. There are MM friendships among them. The ii-th friendship means that students aia_i and bib_i are friends and can contact each other.

The department's final exams will cover NN subjects. Initially, student ii has the past exam papers for subject ii. You are student 1. You want to know how many subjects' past exam information you end up with after friends repeatedly share past exams. So you want the expected value after KK sharing events between friends.

Consider the following event, which happens KK times in order, independently.

  • One of the MM friendships is chosen at random, and the two students in it contact each other. They then share all the past exam information they have.
    • In other words, if the set of subjects one student has is XX and the other's is YY, then after the event both students have the set X∪YX \cup Y.

After the KK events, find the expected number of subjects whose past exam papers you (student 1) have, modulo 998244353.

The expected value is always a rational number. It can be proven that under the constraints of this problem, when written as an irreducible fraction P/QP/Q, Q≢0(mod998244353)Q \not\equiv 0 \pmod{998244353}. Therefore, there is a unique integer RR satisfying R×Q≡P(mod998244353)R \times Q \equiv P \pmod{998244353} and 0≤R<9982443530 \le R < 998244353. This RR is the expected value modulo 998244353. Here, 998244353=223×7×17+1998244353 = 2^{23} \times 7 \times 17 + 1 is prime.

Input

The input consists of multiple datasets. The number of datasets is at most 50. Each dataset is given in the following format.

NN MM KK

a1a_1 b1b_1

⋮\vdots

aMa_M bMb_M

The first line gives NN, MM, and KK. NN is the number of students, an integer from 22 to 1010. MM is the number of friendships, an integer from 11 to N(N−1)/2N(N-1)/2. KK is the number of events, an integer from 11 to 5050.

The next MM lines give the friendships. The ii-th line gives aia_i and bib_i, each an integer from 11 to NN. No friendship connects a student to themselves, so ai≠bia_i \ne b_i for all 1≤i≤M1 \le i \le M. No friendship is given more than once, so for i≠ji \ne j, {ai,bi}≠{aj,bj}\{a_i, b_i\} \ne \{a_j, b_j\}.

The input ends with a line containing three zeros.

Output

For each dataset, print the answer on one line.

Examples1

  1. Example 1

    Input
    4 3 2
    1 2
    1 4
    3 4
    4 3 9
    2 3
    2 4
    3 4
    10 20 30
    3 5
    6 4
    1 6
    1 8
    7 2
    9 3
    2 3
    6 10
    1 9
    3 10
    2 8
    4 10
    5 1
    7 3
    10 8
    4 9
    3 8
    10 1
    5 9
    4 5
    0 0 0
    
    Expected output
    887328316
    1
    369808863