That sounds like a sequence labeling task 3, which is common in NLP, e.g., to assign each word in a sentence a Part-of-Speech tag. You should be able to easily adopt the linked example if it fits the bill.