find stack direction