#!/usr/bin/python -O

__pychecker__ = 'no-shadowbuiltin'

from itertools import imap, takewhile
from sys import argv, exit, stderr, stdin


def main():
    if len(argv) != 2:
        print >>stderr, 'Usage: %s <scheme>' % argv[0]
        exit(2)

    scheme = argv[1]
    lines = imap(str.rstrip, stdin)
    for signature in lines:
        print '<samples unit="%s" scheme="%s">' % (signature, scheme)
        for counters in takewhile(bool, lines):
            print counters
        print '</samples>'


if __name__ == '__main__':
    main()
