I have text file like this:

```
qwery 45
uiopbmc 6
uenja 9999
comxq 8

```

i want to say:

```
mylist=['a','c']
if last letter in the line is 'a' (before the number) and the first letter in the next line is 'c', print both two lines.

```

the result:

```
uenja 9999
comxq 8

```

i know first line in sed like "s/" but how i can say the last letter before the number and first letter in the next line?