**PLEASE DO NOT MARK THE QUESTION AS DUPLICATE WITHOUT READING IT. I DID POST A SIMILAR QUESTION BUT THE STACKOVERFLOW COMMUNITY MEMBERS ASKED ME TO REPOST THE MODIFIED QUESTION SEPARATELY AS THE SOLUTION IS MUCH MORE COMPLICATED GIVEN A SMALL, SUBTLE MODIFICATION.**

Suppose you have the following schema:

```
CREATE TABLE Data
(
  ID INT,
  CXL INT
 )

 INSERT INTO Data (ID, CXL)
 SELECT 1, NULL
 UNION
 SELECT 2, 1
 UNION
 SELECT 3, 2
 UNION
 SELECT 5, 3
 UNION 
 SELECT 6, NULL
 UNION
 SELECT 7, NULL
 UNION
 SELECT 8, 7

```

The column CXL is the ID that cancels a particular ID. So, for example, the first row in the table with ID:1 was good until it was cancelled by ID:2 (CXL column). ID:2 was good until it was cancelled by ID:3. ID:3 was good until it was cancelled by ID:5 so in this sequence the last "GOOD" ID was ID:5. 

**I would like to find the "GOOD" ID as well as the original ID that started EACH chain.** So in this example it would be:

```
Original ID | Latest GOOD ID
     1              5
     6              6
     7              8

```

Here's a fiddle if you want to play with this:
<http://sqlfiddle.com/#!6/68ac48/1>