

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;


int main() {


	int  N, M;
	cin >> N >> M;
	vector<int> s(M);
	vector<int> c(M);
	rep(i, M) cin >> s[i] >> c[i];
	rep(i, M) s[i]--;
	if (N > M)
	{
		cout << -1 << endl;
		return 0;
	}

	vector<int> ans(N);

	rep(i, N) ans[i] = 0;



	rep(i, M) ans[s[i]] = c[i];

	int x = 0;

	for (int i = 0; i<N; i++)
	{
		cout << ans[i] << endl;

		x += ans[i] * pow(10, N-i-1);
	}

	cout << x << endl;

	return 0;
}


