Sorting Atomic Activities for Discovering Spatio-temporal Patterns in Dynamic Scenes