import itertools


def matrix_prod_tee(n):
    """Generates a square matrix: n x n
    using itertools.product()"""
    iterables = itertools.tee(range(1, n + 1), 2)
    return (
        (i, j, i * j)
        for i, j in itertools.product(*iterables)
    )