Amazon Interview Question

Put an item in the correct location based on specific rules provided.