using stack of flags to resolve Schubert problems