Language: C++

//ProblemF.cpp

#include <iostream>

static std::istream & ip = std::cin;
static std::ostream & op = std::cout;

#if OJ_MYPC
#include <ojio.h>
#endif

#ifndef OPENOJIO
#define OPENOJIO
#endif

#if 1 || DEFINE
/***************************************************************/
typedef unsigned long long u64;
typedef long long s64;

typedef unsigned uint;

#define ABS(x) ((x) > 0 ? (x) : -(x))

#define MIN(x, y) ((x) < (y) ? (x) : (y))
#define MAX(x, y) ((x) > (y) ? (x) : (y))

#define MIN3(x, y, z) MIN(x, MIN(y, z))
#define MAX3(x, y, z) MAX(x, MAX(y, z))

#define FillZero(arr) memset(arr, 0, sizeof(arr));

/***************************************************************/
#endif //1 || DEFINE

#include <string>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>

#include <functional> 
#include <assert.h>

//001
//op << setfill('0') << setw(3) << setiosflags(ios::right) << 1;

//op << fixed << setprecision(20);

using namespace std;

//ProblemF.cpp

#define MAXN 200010
#define MOD 924844033LL

#define N (1 << 19)
#define W 10179

template<int _MOD>
class ModInt {
public:
	static const int Mod = _MOD;

private:
	unsigned x;

public:
	ModInt() : x(0) {}
	ModInt(int sig) { int sigt = sig % Mod; if (sigt < 0) sigt += Mod; x = sigt; }
	ModInt(long long sig) { int sigt = sig % Mod; if (sigt < 0) sigt += Mod; x = sigt; }
	int get() const { return (int)x; }

	ModInt &operator+=(const ModInt& b) { if ((x += b.x) >= Mod) x -= Mod; return *this; }
	ModInt &operator-=(const ModInt& b) { if ((x += Mod - b.x) >= Mod) x -= Mod; return *this; }
	ModInt &operator*=(const ModInt& b) { x = (unsigned long long)x * b.x % Mod; return *this; }
	ModInt &operator/=(const ModInt& b) { return *this *= b.inverse(); }

	friend ModInt operator+ (const ModInt& a, const ModInt& b) { return ModInt(a) += b; }
	friend ModInt operator- (const ModInt& a, const ModInt& b) { return ModInt(a) -= b; }
	friend ModInt operator* (const ModInt& a, const ModInt& b) { return ModInt(a) *= b; }
	friend ModInt operator/ (const ModInt& a, const ModInt& b) { return ModInt(a) /= b; }
	friend bool operator== (const ModInt& a, const ModInt& b) { return a.get() == b.get(); }
	friend bool operator!= (const ModInt& a, const ModInt& b) { return a.get() != b.get(); }

	friend std::ostream& operator<<(std::ostream& ostr, const ModInt & a) { return ostr << a.get(); }
	friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }

	ModInt pow(unsigned long long p) const {
		ModInt a = *this;
		ModInt rst = 1;
		while (p) {
			if (p & 1) rst *= a;

			p >>= 1;
			a *= a;
		}
		return rst;
	}

	ModInt inverse() const {
		signed a = x, b = Mod, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; std::swap(a, b);
			u -= t * v; std::swap(u, v);
		}
		return ModInt(u);
	}
};

template<typename Type>
class FFT {
public:
	const int n;
	const Type w;

public:
	FFT(int n, Type w) : n(n), w(w) {
		assert(n > 0);
		Type wk = (Type)1;
		for (int i = 1; i < n; ++i) {
			wk *= w;
			assert(wk != (Type)1);
		}
		assert(wk * w == (Type)1);
		for (--n; n; n >>= 1) assert(n & 1);
	}

	void calc(std::vector<Type>& rst, const std::vector<Type>& p, int ope = 1) {
		assert(p.size() <= n);
		rst = p;

		calc(rst, inv);
	}

	void calc(vector<Type>& p, int ope = 1) {
		assert((int)p.size() <= n);
		p.resize(n, 0);

		Type ww = ope > 0 ? w : 1 / w;
		for (int m = n, mi = 0; m >= 2; m >>= 1, mi++) {
			int mh = m >> 1;

			Type wc = (Type)1;
			for (int i = 0; i < mh; ++i) {
				for (int j = i; j < n; j += m) {
					int k = j + mh;
					Type tmp = p[j] - p[k];
					p[j] += p[k];
					p[k] = wc * tmp;
				}
				wc *= ww;
			}
			ww *= ww;
		}
		int i = 0;
		for (int j = 1; j < n - 1; ++j) {
			for (int k = n >> 1; k >(i ^= k); k >>= 1);
			if (j < i) std::swap(p[i], p[j]);
		}
	}
};

int main(int argc, char* argv[])
{
	OPENOJIO;

	typedef ModInt<MOD> mint;

	static mint fac[MAXN + 1];
	fac[0] = fac[1] = 1;
	for (int i = 2; i <= MAXN; ++i) fac[i] = fac[i - 1] * i;

	static mint fac_inv[MAXN + 1];
	for (int i = 0; i <= MAXN; ++i) {
		fac_inv[i] = 1 / fac[i];
		assert(fac_inv[i] * fac[i] == 1);
	}

	int n;
	vector<vector<int> > nears;

	ip >> n;

	nears.resize(n);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		ip >> a >> b;
		--a; --b;

		nears[a].push_back(b);
		nears[b].push_back(a);
	}

	vector<int> count_sons;
	count_sons.resize(n, 0);

	function<int (int, int)> get_count_sons = [&] (int cur, int father) -> int {
		count_sons[cur] = 1;
		for (auto son : nears[cur]) {
			if (son == father) continue;
			count_sons[cur] += get_count_sons(son, cur);
		}
		return count_sons[cur];
	};

	get_count_sons(0, -1);

	vector<int> b;
	b.resize(n, 0);

	for (int i = 1; i < n; ++i) {
		b[count_sons[i]]++;
		b[n - count_sons[i]]++;
	}

	vector<mint> c(N, 0);
	vector<mint> d(N, 0);

	for (int i = 0; i < n; ++i)
		c[i] = b[i] * fac[i];

	d[0] = 1;
	for (int i = 1; i < n; ++i)
		d[N - i] = fac_inv[i];

	FFT<mint> fft(N, W);
	fft.calc(c);
	fft.calc(d);

	for (int i = 0; i < c.size(); ++i) c[i] *= d[i];
	fft.calc(c, -1);
	mint N_inv = (mint)1 / N;
	assert(N * N_inv == 1);
	for (int i = 0; i < c.size(); ++i) c[i] *= N_inv;

	vector<mint> &rst = d;
	for (int i = 1; i <= n; ++i)
	{
		rst[i] = n * fac[n] * fac_inv[i] * fac_inv[n - i] - fac_inv[i] * c[i];
	}

	for (int i = 1; i <= n; ++i)
	{
		op << rst[i] << endl;
	}

	return 0;
}
/***************************************************************/


Compiler output:
a.cc: In function 'std::istream& operator>>(std::ostream&, const ModInt<_MOD>&)':
a.cc:95:105: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'long long int')
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                    ~~~~ ^~ ~
      |                                                                                                    |       |
      |                                                                                                    |       long long int
      |                                                                                                    std::ostream {aka std::basic_ostream<char>}
a.cc:95:105: note: candidate: 'operator>>(int, long long int)' (built-in)
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                    ~~~~~^~~~
a.cc:95:105: note:   no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int'
In file included from /usr/include/c++/14/string:55,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
  835 |     operator>>(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
                 from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
  131 |     operator>>(byte __b, _IntegerType __shift) noexcept
      |     ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note:   template argument deduction/substitution failed:
a.cc:95:100: note:   cannot convert 'istr' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                    ^~~~
In file included from /usr/include/c++/14/istream:1109,
                 from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
  978 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
      |     ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
  849 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
      |     ^~~~~~~~
/usr/include/c++/14/istream:849:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
  854 |     operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
      |     ^~~~~~~~
/usr/include/c++/14/istream:854:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
  896 |     operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:896:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
  939 |     operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:939:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
  945 |     operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
      |     ^~~~~~~~
/usr/include/c++/14/istream:945:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
 1099 |     operator>>(_Istream&& __is, _Tp&& __x)
      |     ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = long long int&]':
a.cc:95:101:   required from here
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
 1099 |     operator>>(_Istream&& __is, _Tp&& __x)
      |     ^~~~~~~~
In file included from a.cc:40:
/usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)'
 1597 |     operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
      |     ^~~~~~~~
/usr/include/c++/14/bitset:1597:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   95 |         friend std::istream& operator >> (std::ostream& istr, const ModInt & a) { long long t; if (istr >> t) a = t; return istr; }
      |                                                                                                            ^
In file included from a.cc:45:
/usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)'
   76 |     operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f)
      |     ^~~~~~~~
/usr/include/c++/14/iomanip:76:5: note:   template argument deduction/substitution failed:
a.cc:95:108: note:   'std::ostream' {aka