// editor5
#include<stdio.h>
#include<stdlib.h>
struct node{
  int data;
  struct node* next;
};
struct node* head=NULL;
struct node* temp;

void createlist(){
    struct node* newnode=(struct node*)malloc(sizeof(struct node));
    scanf("%d",&newnode->data);
    if(head==NULL){
        head=temp=newnode;
    }
    else
    {
        temp->next=newnode;
        newnode=temp;
    }
}
void printlist(){
    temp=head;
    while(temp->next!=NULL){
        print
        temp=temp->next;
    }
}
void replace(int oldVal,int newVal){
    while(temp->data!=oldVal){
        temp=temp->next;
    }
    if(temp->data==oldVal){
        temp->data=newVal;
    }
    printlist()
}
int main()
{
    int n;
    scanf("%d",&n);
    int oldVal;
    scanf("%d",&oldVal);
    int newVal;
    scanf("%d",&newVal);
    replace(oldVal,newVal);
}