def main():
    global tree, que, answer

    N, m = list(map(int, input().split()))
    tree = {i+1 : set() for i in range(N)}

    for _ in range(m):
        i, j = list(map(int, input().split()))
        tree[i].add(j)
        tree[j].add(i)

    if m % 2 == 1:
        print('-1')
        return

    print(*answer, sep="\n")


if __name__ == "__main__":
    tmp = set()
    que = []
    answer = []
    main()
