import std.stdio;
import std.conv;
import std.algorithm;
import std.string;
import std.file;
import std.math;
 
int main() {
        string l;
        int w, n;
        l = readln(), w = to!int(l.split("\n")[0]); // number of vertical lines (ranes)
        l = readln(), n = to!int(l.split("\n")[0]); // number of holizontal lines (bypasses)
        int[] state;
        for(int i=0; i<w; i++) state ~= i + 1;
        while((l = readln(), l.length)){
                l = l.split("\n")[0];
                int a, b;
                a = to!int(l.split(",")[0]) - 1, b = to!int(l.split(",")[1]) - 1;
                int r;
                r = state[a], state[a] = state[b], state[b] = r;
                }
        for(int i=0; i<w; i++) printf("%d\n", state[i]);
        return 0;
        }
 