Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0099
"""
import sys
import bisect



def main(args):
    #data = [(1, 4), (2, 5), (1, 3), (3, 6), (2, 7)]
    #data = [(1, 4), (2, 5), (2, -3),(3, 4), (1, -1)]
    fisher, event = [int(x) for x in input().split(' ')]
    fishes = [0 for _ in range(fisher + 1)]

    for _ in range(event):
        id, fish = [int(x) for x in input().strip().split(' ')]
        fishes[id] += fish
        max_fish = max(fishes)
        winner = fishes.index(max_fish)
        print('{} {}'.format(winner, max_fish))


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0099
"""
import sys
import bisect



def main(args):
    #data = [(1, 4), (2, 5), (1, 3), (3, 6), (2, 7)]
    #data = [(1, 4), (2, 5), (2, -3),(3, 4), (1, -1)]
    fisher, event = [int(x) for x in input().split(' ')]
    fishes = [0 for _ in range(fisher + 1)]

    winner = 9999999999
    max_fish = -1
    for _ in range(event):
        id, fish = [int(x) for x in input().strip().split(' ')]
        fishes[id] += fish
        if fish > 0:
            if fishes[id] > max_fish:
                max_fish = fishes[id]
                winner = id
            elif fishes[id] == max_fish:
                winner = min(winner, id)
            else:
                pass
        else:
            if winner == id:
                max_fish = max(fishes)
                winner = fishes.index(max_fish)
        print('{} {}'.format(winner, max_fish))


if __name__ == '__main__':
    main(sys.argv[1:])

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0099
"""
import sys
import bisect



def main(args):
    #data = [(1, 4), (2, 5), (1, 3), (3, 6), (2, 7)]
    #data = [(1, 4), (2, 5), (2, -3),(3, 4), (1, -1)]
    fisher, event = [int(x) for x in input().split(' ')]
    fishes = [0 for _ in range(fisher + 1)]

    winner = 9999999999
    max_fish = -1
    for _ in range(event):
        id, fish = [int(x) for x in input().strip().split(' ')]
        fishes[id] += fish
        if fish > 0:
            if fishes[id] > max_fish:
                max_fish = fishes[id]
                winner = id
            elif fishes[id] == max_fish:
                winner = min(winner, id)
            else:
                pass
        else:
            max_fish = max(fishes)
            winner = fishes.index(max_fish)
        print('{} {}'.format(winner, max_fish))


if __name__ == '__main__':
    main(sys.argv[1:])

Fixed submission:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0099
"""
import sys
import bisect



def main(args):
    #data = [(1, 4), (2, 5), (1, 3), (3, 6), (2, 7)]
    #data = [(1, 4), (2, 5), (2, -3),(3, 4), (1, -1)]
    fisher, event = [int(x) for x in input().split(' ')]
    fishes = [0 for _ in range(fisher + 1)]

    winner = 9999999999
    max_fish = -1
    for _ in range(event):
        id, fish = [int(x) for x in input().strip().split(' ')]
        fishes[id] += fish
        if fish > 0:
            if fishes[id] > max_fish:
                max_fish = fishes[id]
                winner = id
            elif fishes[id] == max_fish:
                winner = min(winner, id)
            else:
                pass
        else:
            if winner == id:
                max_fish = max(fishes)
                winner = fishes.index(max_fish)
        print('{} {}'.format(winner, max_fish))


if __name__ == '__main__':
    main(sys.argv[1:])