To keep myself from resubmitting rejected queries to agencies and agents I've already dealt with, I've created a tracking spreadsheet. Every time a rejection email rolls in, I update it.
It's an emotional hit every I do so: I read recently that publishers/agents reject 19 out of every 20 books they receive, and my experience supports that disheartening statistic. I've sent 14 queries, and I've received 12 rejections.
There are all kinds of coping mechanisms and mantras I can turn to as I deal with all of this. But lately I've felt like Muhammad Ali during the Rumble in the Jungle after he absorbed some of Foreman's hardest shots: I'm taking all you can throw at me, and I'm still here.
Nothing against literary agents; I know most of them are hard-working, sincere folks who are doing the best they can with what they have, and many of the rejection letters actually try hard to encourage us wannabes to keep trying. Even in a rejection letter, it's thrilling to be addressed as "Dear Author."
That said, no one likes rejection. (Or, as my brother used to say, "Show me a good loser, and I'll show you a frequent loser.")
Every time I read "Sorry, it's not for us," it's an emotional punch in the stomach. But like Ali I'm still in the fight: I'm still writing, I'm still sending out letters, and I'm still confident that eventually my query letter and writing sample will strike the fancy of the assistant to the intern to the assistant to the executive who will write me that "We love your novel and want to represent you" reply.
I'll leave the consideration of how this applies to all of our struggles in life as an exercise for the reader.