import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[][10^^5] NS;
int[10^^5] ROOT_MEMO, ORIGIN;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    foreach (i; 0..N+M-1) {
        auto ab = readln.split.to!(int[]);
        NS[ab[0]-1] ~= ab[1]-1;
        ++ROOT_MEMO[ab[1]-1];
    }

    int root;
    foreach (int i, n; ROOT_MEMO[0..N]) {
        if (!n) {
            root = i;
            break;
        }
    }
    ORIGIN[root] = -1;

    auto nodes = [root];
    while (!nodes.empty) {
        auto n = nodes[0];
        nodes = nodes[1..$];
        foreach (next; NS[n]) {
            ORIGIN[next] = n;
            nodes ~= next;
        }
    }
    foreach (n; ORIGIN[0..N]) {
        writeln(n+1);
    }
}