Title: Adaptive sequence recognition with memory elements