Basically, you want to match all the elements that are descendants of #first and that are not children of
elements nested more than one level deep under #first.
(I'm not sure about that last under #first part, but implementing it allows us to support
elements above #first in the ancestor chain.)
Technically, the following selector alone should fulfill your requirements:
var inputs = $("#first td:not(#first td td) > input");
If this does not work in your browser (Sizzle should be up to the task I think, but complex selectors like :not() are always tricky), you can delegate the processing to jQuery methods:
var inputs = $("#first td").not("#first td td").children("input");
Original answer follows:
You can use not() to exclude elements that have more than one
ancestor:
var firstLevelCells = $("#first").find("input").not("td td input");