A simple algorithm to construct a consistent extension of a partially oriented graph