A dog weighs two pounds less than three times the weight of a cat. The dog also weights twenty-two more pounds than the cat. Write and solve an equation to find the weights of the cat and the dog.