Store object ids not pointers in local arrays

Do dont pre-increment counts. Only inc when adding a new element
to an index.
When checking for subnet/router, add router/subnet to array if needed.
Fix comparison functions (a - b, not b - a) and inline.
Add print_[subnet|router] functions
Store router IDs in pair index, not pointers

Add print_pair[_tree] functions
Print a pair id two u32s (0xa_b)
Add pair ID to router

Improve debug output
Realloc the correct pair id array size
Free router->pairs during cleanup