The D40/D50 are fine cameras. The D50 has better lens compatibility, but.
In all honesty, there's not much in it at that level - Canon, Nikon, Pentax, Sony et al are all decent enough. Do you have an idea about what sort of photography you want to do? Then find the lenses that look like the most useful. Then find which mounts they come in. If you don't, then you'll be able to find the kit lenses cheap on eBay. Once you've used one of those for a while, you'll know what you need in the next lens.
The D40/D50 are fine cameras. The D50 has better lens compatibility, but.
In all honesty, there's not much in it at that level - Canon, Nikon, Pentax, Sony et al are all decent enough. Do you have an idea about what sort of photography you want to do? Then find the lenses that look like the most useful. Then find which mounts they come in. If you don't, then you'll be able to find the kit lenses cheap on eBay. Once you've used one of those for a while, you'll know what you need in the next lens.