<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def links_to_data(self, col_name_col_num, col_val_col_num, id_a_col_num, id_b_col_num):
 """ This is the reverse of data_to_links and takes a links table and generates a data table as follows Input Table Output Table Cat_Name,CAT_val,Person_a,person_b NAME,Location Location,Perth,John,Fred John,Perth Location,Perth,John,Cindy Cindy,Perth Location,Perth,Fred,Cindy Fred,Perth """

        print('Converting links to data')
        self.op_data
        unique_ids = []
        unique_vals = []
        self.op_data.append(['Name', self.ip_data[1][col_name_col_num]])
        
        for r in self.ip_data[1:]:
            if r[id_a_col_num] not in unique_ids:
                unique_ids.append(r[id_a_col_num])
                self.op_data.append([r[id_a_col_num], r[col_val_col_num]])
            if r[id_b_col_num] not in unique_ids:
                unique_ids.append(r[id_b_col_num])
            if r[col_val_col_num] not in unique_vals:
                unique_vals.append(r[col_val_col_num])
                
        
        #for id in unique_ids:
        #    self.op_data.append([id, ''])
        
            
        print('unique_ids = ', unique_ids)
        print('unique_vals= ', unique_vals)
        print('op_data   = ', self.op_data)
        
        
        return self.op_data