Okay, giving us data samples one at a time will probably not going to be efficient. We can give you a solution for this one, but you might come back again with a different sample later on.
How about giving us enough samples and a clear description of your rules, so we can formulate a more permanent solution?