You just have to find the position of 1 in each column:
sage: M = matrix([[1, 0, 0],[0, 0, 1],[0, 1, 0]])