Pick and print

Hi Friends,

I'm facing an issue. I am having a file as under :

a1
b1
c1
a2
a3
a4
b4
a5
b5

and I need to get the output as under:

a1 b1
a4 b4
a5 b5

i.e. to pick the columns where a and b are consecutive and ignoring rest.

I was trying some thing sily as:

cat myfile | egrep -i "a|b"

Thanks in advance..

sed -n '/^a/{$q;N;s/\(^a.*\)\n\(b.*\)/\1 \2/p}' inputfile
awk '/^b/ && p~/^a/{print p,$0}{p=$0}' infile