Language: C++

//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

template <class T = usize> class rep {
	const T f, l;

public:
	class itr {
		friend rep;
		T i;
		itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		T operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(const T first, const T last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
template <class T = usize> class revrep {
	const T f, l;

public:
	class itr {
		friend revrep;
		T i;
		itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		T operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(const T first, const T last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

#include <cstdint>

template <::std::uint_least32_t MODULO> class modint {
	using u32 = ::std::uint_least32_t;
	using u64 = ::std::uint_least64_t;

public:
	using value_type = u32;
	u32 a;
	modint() noexcept : a(0) {}
	modint(const u32 x) noexcept : a(x) {}
	u32 value() const noexcept { return a; }
	modint operator+(const modint &o) const noexcept {
		return a + o.a < MODULO ? modint(a + o.a) : modint(a + o.a - MODULO);
	}
	modint operator-(const modint &o) const noexcept {
		return modint(a < o.a ? a + MODULO - o.a : a - o.a);
	}
	modint operator*(const modint &o) const noexcept {
		return modint(static_cast<u64>(a) * o.a % MODULO);
	}
	modint operator/(const modint &o) const {
		return modint(static_cast<u64>(a) * (~o).a % MODULO);
	}
	modint &operator+=(const modint &o) noexcept {
		if ((a += o.a) >= MODULO)
			a -= MODULO;
		return *this;
	}
	modint &operator-=(const modint &o) noexcept {
		if (a < o.a)
			a += MODULO;
		a -= o.a;
		return *this;
	}
	modint &operator*=(const modint &o) noexcept {
		a = static_cast<u64>(a) * o.a % MODULO;
		return *this;
	}
	modint &operator/=(const modint &o) {
		a = static_cast<u64>(a) * (~o).a % MODULO;
		return *this;
	}
	modint operator~() const noexcept { return pow(MODULO - 2); }
	modint operator-() const noexcept { return a ? modint(MODULO - a) : *this; }
	modint operator++() noexcept { return a == MODULO - 1 ? a = 0 : ++a, *this; }
	modint operator--() noexcept { return a ? --a : a = MODULO - 1, *this; }
	bool operator==(const modint &o) const noexcept { return a == o.a; }
	bool operator!=(const modint &o) const noexcept { return a != o.a; }
	bool operator<(const modint &o) const noexcept { return a < o.a; }
	bool operator<=(const modint &o) const noexcept { return a <= o.a; }
	bool operator>(const modint &o) const noexcept { return a > o.a; }
	bool operator>=(const modint &o) const noexcept { return a >= o.a; }
	explicit operator bool() const noexcept { return a; }
	explicit operator u32() const noexcept { return a; }
	modint pow(u32 x) const noexcept {
		u64 t = a, u = 1;
		while (x) {
			if (x & 1)
				u = u * t % MODULO;
			t = (t * t) % MODULO;
			x >>= 1;
		}
		return modint(u);
	}
};


#include <algorithm>
#include <iostream>
#include <utility>
#include<cstdio>
#include<numeric>

using mint = modint<1000000007>;

int main() {
	using p32 = ::std::pair<u32, u32>;

	usize n, m;
	::std::cin >> n >> m;
	::std::vector<p32> d(m);
	::std::vector<usize> id(m);
	::std::vector<u32> ans(m);
	::std::iota(id.begin(), id.end(), 0);

	for (auto &e : d) {
		::std::cin >> e.second >> e.first;
	}

	::std::sort(id.begin(),id.end(),
		[&](usize l, usize r) {return d[l].first < d[r].first;});

	::std::vector<usize> count(n+1, 0);
	
	for (const auto i:id) {
		ans[i] =
			d[i].second * 1000000 +
			(++count[d[i].second]);
	}

	for (const auto e : ans) {
		printf("%012u\n", unsigned int(e));
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:174:35: error: expected primary-expression before 'unsigned'
  174 |                 printf("%012u\n", unsigned int(e));
      |                                   ^~~~~~~~