#CF2240F. 猎兽 / F. Hunting the Beast

猎兽 / F. Hunting the Beast

猎兽

英文题名:F. Hunting the Beast
来源Codeforces 2240F
比赛:Codeforces Round 1105 (Div. 2)
时间限制:2 seconds
空间限制:256 megabytes

题目描述

考虑 nn 个点的无自环函数图。一个大小为 mm 的起点集合若能沿有向边到达所有点,则称成功。图的价值为成功集合数。求所有 (n1)n(n-1)^n 个函数图价值之和。

输入格式

第一行输入 tt。每组输入 n,mn,m

输出格式

输出答案对 998244353998244353 取模。

样例

5
2 1
3 1
3 2
4 2
8 3
2
12
18
216
20415360