Match input and output state using ints.