Which pins to use on Uno or Mega

I have a L298 motor driver and a Ky-040 rotary encoder - I want to use these with either a UNO R3 or a Mega 2560.
Can anyone advise me of which pins i should use.

There will be two L298 and Ky-040 .

To operate an L298 any digital out will work. If PWM will be used, use pins that have PWM support.
Rotary encoders sometimes need interrupt supported pins. Pin 2 and 3 on UNO I think.

Thank you, can I assume then that a Uno will only handle one Ky040 .

No, the Encoder library (among others) will allow one to use one interrupt pin and one non-interrupt pin for each encoder. If the encoders are controlled by hand, you don't really need interrupts if you write non-blocking code and your loop time is fast enough (50ms-ish or better).