using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    int N;
    int[] A;
    int[] B;
    int[] ansA;
    int[] ansB;
    int[] numA;
    int[] numB;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        A = new int[int.Parse(str[0])];
        for(int i=0;i<A.Length;i++){
            A[i] = int.Parse(str[i+1]);
        }
        str = Console.ReadLine().Split(' ');
        B = new int[int.Parse(str[0])];
        for(int i=0;i<B.Length;i++){
            B[i] = int.Parse(str[i+1]);
        }
        numA = new int[N];
        numB = new int[N];
        for(int i=0;i<N;i++){
            numA[i] = A.Length;
            numB[i] = B.Length;
        }
        ansA = new int[N];
        ansB = new int[N];
        ansB[0] = 2;
        UpdataA(0,2);
        ansB[0] = 0;
        UpdataB(0,2);
        for(int i=1;i<N;i++){
            if(ansA[i] == 0){
                sb.Append("Loop ");
            }
            else if(ansA[i] == 1){
                sb.Append("Win ");
            }
            else{
                sb.Append("Lose ");
            }
        }
        sb.Append("\n");
        for(int i=1;i<N;i++){
            if(ansB[i] == 0){
                sb.Append("Loop ");
            }
            else if(ansB[i] == 1){
                sb.Append("Win ");
            }
            else{
                sb.Append("Lose ");
            }
        }
        sb.Append("\n");
    }
    void UpdataA(int x,int b){
        if(ansA[x] > 0){
            return ;
        }
        ansA[x] = b;
        if(b == 1){
            for(int i=0;i<B.Length;i++){
                numB[(x+N-B[i])%N]--;
                if(numB[(x+N-B[i])%N] == 0){
                    UpdataB((x+N-B[i])%N,2);
                }
            }
        }
        else{
            for(int i=0;i<B.Length;i++){
                UpdataB((x+N-B[i])%N,1);
            }
        }
    }
    void UpdataB(int x,int b){
        if(ansB[x] > 0){
            return ;
        }
        ansB[x] = b;
        if(b == 1){
            for(int i=0;i<A.Length;i++){
                numA[(x+N-A[i])%N]--;
                if(numA[(x+N-A[i])%N] == 0){
                    UpdataA((x+N-A[i])%N,2);
                }
            }
        }
        else{
            for(int i=0;i<A.Length;i++){
                UpdataA((x+N-A[i])%N,1);
            }
        }
    }
}


use std::str::{FromStr};

fn main() {
  let mut r = Read::new();
  let n = r.one();
  let rs = r.many();
  let ms = r.many();

  let mut tbl = [[0; 7000]; 2];
  let mut seen = [[false; 7000]; 2];
  let mut nchildren = [[0; 7000]; 2];
  let mut ps = [rs, ms];
  tbl[0][0] = -1;
  tbl[1][0] = -1;
  seen[0][0] = true;
  seen[1][0] = true;

  for p in 0..2 {
    go(n, &mut ps, &mut tbl, &mut seen, &mut nchildren, p, 0)
  }

  for p in 0..2 {
    for i in 1..n {
      print!("{} ", match tbl[p][i] {
          1 => "Win",
          0 => "Loop",
          _ => "Lose"
      });
    }
    print!("\n");
  }
}

fn go(n: usize, ps: &[Vec<usize>; 2], tbl: &mut [[i32; 7000]; 2], seen: &mut [[bool; 7000]; 2], nchildren: &mut [[usize; 7000]; 2], p1: usize, i1: usize) {
  let p2 = 1 - p1;
  for i2 in ps[p2].iter().map(|&x| (i1 + n - x) % n).filter(|&i2| i2 > 0) {
    if seen[p2][i2] { continue; }
    if tbl[p1][i1] == 1 && { nchildren[p2][i2] += 1; nchildren[p2][i2] == ps[p2].len() } || tbl[p1][i1] == -1 {
      seen[p2][i2] = true;
      tbl[p2][i2] = -tbl[p1][i1];
      go(n, ps, tbl, seen, nchildren, p2, i2);
    }
  }
}

struct Read { s: String }

impl Read {
  fn new() -> Read {
    Read{s: String::new()}
  }

  #[allow(unused_must_use)]
  fn line(&mut self) -> &str {
    self.s.clear();
    std::io::stdin().read_line(&mut self.s);
    self.s.trim()
  }

  fn one<T: FromStr>(&mut self) -> T where <T as FromStr>::Err: std::fmt::Debug {
    self.line().parse().unwrap()
  }

  fn many<T: FromStr>(&mut self) -> Vec<T> where <T as FromStr>::Err: std::fmt::Debug {
    self.line().split(' ').map(|x| x.parse().unwrap()).collect()
  }
}


use std::str::{FromStr};

fn main() {
  let mut r = Read::new();
  let n = r.one();
  let rs = r.many();
  let ms = r.many();

  let mut tbl = [[0; 7000]; 2];
  let mut seen = [[false; 7000]; 2];
  let mut nchildren = [[0; 7000]; 2];
  let mut ps = [&rs[1..], &ms[1..]];
  tbl[0][0] = -1;
  tbl[1][0] = -1;
  seen[0][0] = true;
  seen[1][0] = true;

  for p in 0..2 {
    go(n, &mut ps, &mut tbl, &mut seen, &mut nchildren, p, 0)
  }

  for p in 0..2 {
    for i in 1..n {
      print!("{} ", match tbl[p][i] {
          1 => "Win",
          0 => "Loop",
          _ => "Lose"
      });
    }
    print!("\n");
  }
}

fn go(n: usize, ps: &[&[usize]; 2], tbl: &mut [[i32; 7000]; 2], seen: &mut [[bool; 7000]; 2], nchildren: &mut [[usize; 7000]; 2], p1: usize, i1: usize) {
  let p2 = 1 - p1;
  for i2 in ps[p2].iter().map(|&x| (i1 + n - x) % n).filter(|&i2| i2 > 0) {
    if seen[p2][i2] { continue; }
    if tbl[p1][i1] == 1 && { nchildren[p2][i2] += 1; nchildren[p2][i2] == ps[p2].len() } || tbl[p1][i1] == -1 {
      seen[p2][i2] = true;
      tbl[p2][i2] = -tbl[p1][i1];
      go(n, ps, tbl, seen, nchildren, p2, i2);
    }
  }
}

struct Read { s: String }

impl Read {
  fn new() -> Read {
    Read{s: String::new()}
  }

  #[allow(unused_must_use)]
  fn line(&mut self) -> &str {
    self.s.clear();
    std::io::stdin().read_line(&mut self.s);
    self.s.trim()
  }

  fn one<T: FromStr>(&mut self) -> T where <T as FromStr>::Err: std::fmt::Debug {
    self.line().parse().unwrap()
  }

  fn many<T: FromStr>(&mut self) -> Vec<T> where <T as FromStr>::Err: std::fmt::Debug {
    self.line().split(' ').map(|x| x.parse().unwrap()).collect()
  }
}


use std::str::{FromStr};

fn main() {
  let mut r = Read::new();
  let n = r.one();
  let rs = r.many();
  let ms = r.many();

  let mut tbl = [[0; 7000]; 2];
  let mut seen = [[false; 7000]; 2];
  let mut nchildren = [[0; 7000]; 2];
  let ps = [&rs[1..], &ms[1..]];
  tbl[0][0] = -1;
  tbl[1][0] = -1;
  seen[0][0] = true;
  seen[1][0] = true;

  for p in 0..2 {
    go(n, &ps, &mut tbl, &mut seen, &mut nchildren, p, 0)
  }

  for p in 0..2 {
    for i in 1..n {
      print!("{} ", match tbl[p][i] {
          1 => "Win",
          0 => "Loop",
          _ => "Lose"
      });
    }
    print!("\n");
  }
}

fn go(n: usize, ps: &[&[usize]; 2], tbl: &mut [[i32; 7000]; 2], seen: &mut [[bool; 7000]; 2], nchildren: &mut [[usize; 7000]; 2], p1: usize, i1: usize) {
  let p2 = 1 - p1;
  for i2 in ps[p2].iter().map(|&x| (i1 + n - x) % n).filter(|&i2| i2 > 0) {
    if seen[p2][i2] { continue; }
    if tbl[p1][i1] == 1 && { nchildren[p2][i2] += 1; nchildren[p2][i2] == ps[p2].len() } || tbl[p1][i1] == -1 {
      seen[p2][i2] = true;
      tbl[p2][i2] = -tbl[p1][i1];
      go(n, ps, tbl, seen, nchildren, p2, i2);
    }
  }
}

struct Read { s: String }

impl Read {
  fn new() -> Read {
    Read{s: String::new()}
  }

  #[allow(unused_must_use)]
  fn line(&mut self) -> &str {
    self.s.clear();
    std::io::stdin().read_line(&mut self.s);
    self.s.trim()
  }

  fn one<T: FromStr>(&mut self) -> T where <T as FromStr>::Err: std::fmt::Debug {
    self.line().parse().unwrap()
  }

  fn many<T: FromStr>(&mut self) -> Vec<T> where <T as FromStr>::Err: std::fmt::Debug {
    self.line().split(' ').map(|x| x.parse().unwrap()).collect()
  }
}


#!/usr/bin/env python3
from __future__ import absolute_import
from sys import stdin,stdout
from itertools import imap

def ri():
    return imap(int, raw_input().split())

n = int(raw_input())
a = list(ri())
b = list(ri())
a = a[1:]
b = b[1:]

T = [[-1 for i in xrange(2)] for j in xrange(n)]
T[0][0] = 1
T[0][1] = 0

for j in xrange(10**9):
    c = 0
    for i in xrange(n-1, -1, -1):
        #T[i][0]
        flag = 0
        for k in a:
            ii = (i+k)%n
            if ii == 0 or T[ii][1] == 0:
                if T[i][0] !=0:
                    c = 1
                T[i][0] = 0
                break
            if T[ii][1] != 1:
                flag = 1
        else:
            if flag == 0:
                if T[i][0] !=1:
                    c = 1
                T[i][0] = 1
        flag = 0
        for k in b:
            ii = (i+k)%n
            if ii == 0 or T[ii][0] == 1:
                if T[i][1] !=1:
                    c = 1
                T[i][1] = 1
                break
            if T[ii][0] != 0:
                flag = 1
        else:
            if flag == 0:
                if T[i][1] !=0:
                    c = 1
                T[i][1] = 0
    if c == 0:
        break

ansa = [u"Win", u"Lose", u"Loop"]
ansb = [u"Lose", u"Win", u"Loop"]
aa = [ansa[T[i][0]] for i in xrange(1, n)]
bb = [ansb[T[i][1]] for i in xrange(1, n)]

print u" ".join(aa)
print u" ".join(bb)


#!/usr/bin/env python3
from __future__ import absolute_import
from sys import stdin,stdout
from copy import deepcopy
from itertools import imap

def ri():
    return imap(int, raw_input().split())

n = int(raw_input())
a = list(ri())
b = list(ri())
a = a[1:]
b = b[1:]

T = [[-1 for i in xrange(2)] for j in xrange(n)]
T[0][0] = 1
T[0][1] = 0

Tprv = deepcopy(T)
for j in xrange(10**9):
    for i in xrange(n-1, -1, -1):
        #T[i][0]
        flag = 0
        for k in a:
            ii = (i+k)%n
            if ii == 0 or T[ii][1] == 0:
                T[i][0] = 0
                break
            if T[ii][1] != 1:
                flag = 1
        else:
            if flag == 0:
                T[i][0] = 1
        flag = 0
        for k in b:
            ii = (i+k)%n
            if ii == 0 or T[ii][0] == 1:
                T[i][1] = 1
                break
            if T[ii][0] != 0:
                flag = 1
        else:
            if flag == 0:
                T[i][1] = 0
    if Tprv == T:
        break
    Tprv = deepcopy(T)

ansa = [u"Win", u"Lose", u"Loop"]
ansb = [u"Lose", u"Win", u"Loop"]
aa = [ansa[T[i][0]] for i in xrange(1, n)]
bb = [ansb[T[i][1]] for i in xrange(1, n)]

print u" ".join(aa)
print u" ".join(bb)


n = int(input())

sR = list(map(int, input().split()[1:]))
sM = list(map(int, input().split()[1:]))
s = [sR, sM]

UNK = -1
PROC = 0
LOOP = 1
WIN = 2
LOSE = 3

A = [[UNK] * n for i in range(2)]
# ricky turn 0
# morty turn 1
A[0][0] = LOSE
A[1][0] = LOSE

def visit(turn, planet):
    if A[turn][planet] != UNK:
        return A[turn][planet]

    A[turn][planet] = PROC

    next_turn = (turn + 1) % 2

    lose_exists = False
    loop_exists = False
    wins = 0

    for diff in s[turn]:
        next_planet = (planet + diff) % n
        outcome = visit(next_turn, next_planet)
        if outcome == LOSE:
            lose_exists = True
            break
        #elif outcome == PROC:
        #    loop_exists = True
        elif outcome == WIN:
            wins += 1

    verdict = UNK
    if lose_exists:
        verdict = WIN
    if wins == len(s[turn]):
        verdict = LOSE

    #if loop_exists and verdict != WIN:  # and not exit_exists:
    #    verdict = UNK

    A[turn][planet] = verdict
    return verdict

for i in range(1, n):
    visit(0, i)
    visit(1, i)

for i in range(1, n):
    print("Win" if A[0][i] == WIN else "Lose" if A[0][i] == LOSE else "Loop", end=" ")
print()
for i in range(1, n):
    print("Win" if A[1][i] == WIN else "Lose" if A[1][i] == LOSE else "Loop", end=" ")


import queue

n = int(input())

sR = list(map(int, input().split()[1:]))
sM = list(map(int, input().split()[1:]))
s = [sR, sM]

UNK = -1
WIN = 2
LOSE = 3

A = [[UNK] * n for i in range(2)]
CNT = [[0] * n for i in range(2)]
V = [[False] * n for i in range(2)]
# ricky turn 0
# morty turn 1
A[0][0] = LOSE
A[1][0] = LOSE

Q = queue.Queue()
Q.put((0, 0))
Q.put((1, 0))

while not Q.empty():
    turn, planet = Q.get()

    prev_turn = 1 - turn
    for diff in s[prev_turn]:
        prev_planet = (n + planet - diff) % n
        if prev_planet == 0:
            continue
        if A[turn][planet] == LOSE:
            A[prev_turn][prev_planet] = WIN
        elif A[turn][planet] == WIN:
            CNT[prev_turn][prev_planet] += 1
        if CNT[prev_turn][prev_planet] == len(s[prev_turn]):
            A[prev_turn][prev_planet] = LOSE

        if A[prev_turn][prev_planet] != UNK and not V[prev_turn][prev_planet]:
            Q.put((prev_turn, prev_planet))
            V[prev_turn][prev_planet] = True

print(' '.join(["Win" if A[0][i] == WIN else "Lose" if A[0][i] == LOSE else "Loop" for i in range(1, n)]))
print(' '.join(["Win" if A[1][i] == WIN else "Lose" if A[1][i] == LOSE else "Loop" for i in range(1, n)]))


#!/usr/bin/env python3
from sys import stdin,stdout
from copy import deepcopy

def ri():
    return map(int, input().split())

n = int(input())
a = list(ri())
b = list(ri())
a = a[1:]
b = b[1:]

T = [[-1 for i in range(2)] for j in range(n)]
T[0][0] = 1
T[0][1] = 0

Tprv = deepcopy(T)
for j in range(10**9):
    for i in range(n-1, -1, -1):
        #T[i][0]
        flag = 0
        for k in a:
            ii = (i+k)%n
            if ii == 0 or T[ii][1] == 0:
                T[i][0] = 0
                break
            if T[ii][1] != 1:
                flag = 1
        else:
            if flag == 0:
                T[i][0] = 1
        flag = 0
        for k in b:
            ii = (i+k)%n
            if ii == 0 or T[ii][0] == 1:
                T[i][1] = 1
                break
            if T[ii][0] != 0:
                flag = 1
        else:
            if flag == 0:
                T[i][1] = 0
    if Tprv == T:
        break
    Tprv = deepcopy(T)

ansa = ["Win", "Lose", "Loop"]
ansb = ["Lose", "Win", "Loop"]
aa = [ansa[T[i][0]] for i in range(1, n)]
bb = [ansb[T[i][1]] for i in range(1, n)]

print(" ".join(aa))
print(" ".join(bb))


#!/usr/bin/env python3
from sys import stdin,stdout

def ri():
    return map(int, input().split())

n = int(input())
a = list(ri())
b = list(ri())
a = a[1:]
b = b[1:]

T = [[-1 for i in range(2)] for j in range(n)]
T[0][0] = 1
T[0][1] = 0

for j in range(10**9):
    c = 0
    for i in range(n-1, -1, -1):
        #T[i][0]
        flag = 0
        for k in a:
            ii = (i+k)%n
            if ii == 0 or T[ii][1] == 0:
                if T[i][0] !=0:
                    c = 1
                T[i][0] = 0
                break
            if T[ii][1] != 1:
                flag = 1
        else:
            if flag == 0:
                if T[i][0] !=1:
                    c = 1
                T[i][0] = 1
        flag = 0
        for k in b:
            ii = (i+k)%n
            if ii == 0 or T[ii][0] == 1:
                if T[i][1] !=1:
                    c = 1
                T[i][1] = 1
                break
            if T[ii][0] != 0:
                flag = 1
        else:
            if flag == 0:
                if T[i][1] !=0:
                    c = 1
                T[i][1] = 0
    if c == 0:
        break

ansa = ["Win", "Lose", "Loop"]
ansb = ["Lose", "Win", "Loop"]
aa = [ansa[T[i][0]] for i in range(1, n)]
bb = [ansb[T[i][1]] for i in range(1, n)]

print(" ".join(aa))
print(" ".join(bb))


using System;
using System.Collections.Generic;
//using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

//using System.Threading;

namespace ReadWriteTemplate
{
    public static class Solver
    {
        public static void Solve()
        {
            int n = ReadInt();
            List<int> s1 = ReadIntArray().ToList();
            s1.RemoveAt(0);
            List<int> s2 = ReadIntArray().ToList();
            s2.RemoveAt(0);

            // 1 - win, 2 - lose
            int[] a = new int[n];
            int[] ac = new int[n];
            int[] b = new int[n];
            int[] bc = new int[n];
            a[0] = 2;
            b[0] = 2;

            Queue<int> aq = new Queue<int>();
            Queue<int> bq = new Queue<int>();
            aq.Enqueue(0);
            bq.Enqueue(0);

            while (aq.Any() || bq.Any())
            {
                while (aq.Any())
                {
                    int t = aq.Dequeue();
                    foreach (var x in s2)
                    {
                        var d = Add(t, x, n);
                        if (b[d] == 0)
                        {
                            b[d] = 1;
                            foreach (var y in s1)
                            {
                                var p = Add(d, y, n);
                                ac[p]++;
                                if (ac[p] == s1.Count)
                                {
                                    a[p] = 2;
                                    aq.Enqueue(p);
                                }
                            }
                        }
                    }
                }
                while (bq.Any())
                {
                    int t = bq.Dequeue();
                    foreach (var x in s1)
                    {
                        var d = Add(t, x, n);
                        if (a[d] == 0)
                        {
                            a[d] = 1;
                            foreach (var y in s2)
                            {
                                var p = Add(d, y, n);
                                bc[p]++;
                                if (bc[p] == s2.Count && b[p] == 0)
                                {
                                    b[p] = 2;
                                    bq.Enqueue(p);
                                }
                            }
                        }
                    }
                }
            }

            for (int i = n - 1; i > 0; i--)
            {
                Print(a[i]);
            }
            Writer.WriteLine();
            for (int i = n - 1; i > 0; i--)
            {
                Print(b[i]);
            }
        }

        private static void Print(int d)
        {
            string result = null;
            switch (d)
            {
                case 0:
                    result = "Loop";
                    break;
                case 1:
                    result = "Win";
                    break;
                case 2:
                    result = "Lose";
                    break;
            }
            Writer.Write("{0} ", result);
        }

        private static int Add(int t, int x, int n)
        {
            int d = t + x;
            if (d >= n)
            {
                d -= n;
            }
            return d;
        }

        public static void Main()
        {
            //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif
            //Reader = File.OpenText("concatenation.in"); Writer = File.CreateText("concatenation.out");

            Solve();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

#region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static string ReadLine()
        {
            return Reader.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

#endregion
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();

            var dp = new int[2, n - 1];
            for (var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                dp[0, n - val - 1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                dp[1, n - val - 1] = 1;
            }
            var changed = true;
            for(var k=0;k<200;k++)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[0, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < rick.Count; j++)
                    {
                        var pos = (i + rick[j]) % n;
                        possib[dp[1, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[0, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[0, i] = 2;
                        changed = true;
                    }
                }

                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[1, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var pos = (i + marty[j]) % n;
                        possib[dp[0, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[1, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[1, i] = 2;
                        changed = true;
                    }

                }
            }

            var sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[0, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }
            writer.WriteLine(sb);

            sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[1, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }

            writer.WriteLine(sb);
            writer.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var rickWin = new int[n - 1];
            var martyWin = new int[n - 1];

            for(var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                rickWin[n - val-1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                martyWin[n - val-1] = 1;
            }

            var changed = true;
            while (changed)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (rickWin[i] != 0)
                    {
                        continue;
                    }
                    var loose = true;
                    for (var j = 0; j < rick.Count; j++)
                    {
                        if (martyWin[(i + rick[j]) % n] != 1)
                        {
                            loose = false;
                        }
                    }
                    if (loose)
                    {
                        rickWin[i] = 2;
                        martyWin[i] = 1;
                        changed = true;
                    }
                }
                for (var i = 0; i < n - 1; i++)
                {
                    if (martyWin[i] != 0)
                    {
                        continue;
                    }
                    var loose = true;
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var val = rickWin[(i + marty[j]) % n];
                        if (val != 1)
                        {
                            loose = false;
                        }
                    }
                    if (loose)
                    {
                        martyWin[i] = 2;
                        rickWin[i] = 1;
                        changed = true;
                    }
                }
            }
            var sb = new StringBuilder();
                for (var i = 0; i < n - 1; i++)
                {
                    if (rickWin[i] == 1)
                    {
                        sb.Append("Win");
                    }
                    else if (rickWin[i] == 2)
                    {
                        sb.Append("Lose");
                    }
                    else
                    {
                        sb.Append("Loop");
                    }
                    sb.Append(" ");
                }
                Console.WriteLine(sb);

                sb = new StringBuilder();
                for (var i = 0; i < n - 1; i++)
                {
                    if (martyWin[i] == 1)
                    {
                        sb.Append("Win");
                    }
                    else if (martyWin[i] == 2)
                    {
                        sb.Append("Lose");
                    }
                    else
                    {
                        sb.Append("Loop");
                    }
                    sb.Append(" ");
                }

            Console.WriteLine(sb);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();

            var dp = new int[2, n - 1];
            for (var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                dp[0, n - val - 1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                dp[1, n - val - 1] = 1;
            }
            var changed = true;
            for(var k=0;k<100000;k++)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[0, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < rick.Count; j++)
                    {
                        var pos = (i + rick[j]) % n;
                        possib[dp[1, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[0, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[0, i] = 2;
                        changed = true;
                    }
                }

                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[1, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var pos = (i + marty[j]) % n;
                        possib[dp[0, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[1, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[1, i] = 2;
                        changed = true;
                    }

                }
            }

            var sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[0, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }
            writer.WriteLine(sb);

            sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[1, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }

            writer.WriteLine(sb);
            writer.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static List<int> rick;
        static List<int> mort;
        static int n;
        static void set(int who, int pos, int value, int[,]result, int[][] storage)
        {
            if(result[who, pos] != 0)
            {
                return;
            }
            // WIN
            if(value == 1)
            {
                result[who, pos] = 1;
                if (who == 0)
                {
                    for (var i = 0; i < mort.Count; i++)
                    {
                        storage[(who + 1) % 2][(pos + n - mort[i]) % n]--;
                        if(storage[(who + 1) % 2][(pos + n - mort[i]) % n] == 0)
                        {
                            set((who + 1) % 2, (pos + n - mort[i]) % n, 0, result, storage);
                        }
                    }
                } else
                {
                    for (var i = 0; i < rick.Count; i++)
                    {
                        storage[(who + 1) % 2][(pos + n - rick[i]) % n]--;
                        if (storage[(who + 1) % 2][(pos + n - rick[i]) % n] == 0)
                        {
                            set((who + 1) % 2, (pos + n - rick[i]) % n, 0, result, storage);
                        }
                    }
                }
            } else
            {
                result[who, pos] =2;
                if (who == 0)
                {
                    for (var i = 0; i < mort.Count; i++)
                    {
                        set((who + 1) % 2, (pos + n - mort[i]) % n, 1, result, storage);
                    }
                }
                else
                {
                    for (var i = 0; i < rick.Count; i++)
                    {
                        set((who + 1) % 2, (pos + n - rick[i]) % n, 1, result, storage);

                    }
                }
            }
        }
        static void Main(String[] args)
        {
            n = int.Parse(Console.ReadLine());
            rick = Console.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            mort = Console.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var storage = new int[2][];
            storage[0] = new int[n];
            storage[1] = new int[n];

            for(var j = 0; j < 2; j++)
            {
                for(var i = 0; i < n; i++)
                {
                    if (j == 0)
                    {
                        storage[j][i] = rick.Count;
                    } else
                    {
                        storage[j][i] = mort.Count;
                    }
                }
            }

            var result = new int[2, n];
            for (var j = 0; j < 2; j++)
            {
                result[j, n - 1] = 1;
            }
                for (var i = 0; i < rick.Count; i++)
            {
                set(0, n - rick[i]-1, 1, result, storage);
            }

            for (var i = 0; i < mort.Count; i++)
            {
                set(1, n - mort[i] - 1, 1, result, storage);
            }

            for (var j = 0; j < 2; j++)
            {
                var sb = new StringBuilder();
                for (var i = 0; i < n-1; i++)
                {
                    if (result[j, i] == 1)
                    {
                        sb.Append("Win ");
                    }
                    else {
                        sb.Append("Lose ");
                    }
                }
                Console.WriteLine(sb);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();

            var dp = new int[2, n - 1];
            for (var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                dp[0, n - val - 1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                dp[1, n - val - 1] = 1;
            }
            var changed = true;
            while (changed)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[0, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < rick.Count; j++)
                    {
                        var pos = (i + rick[j]) % n;
                        possib[dp[1, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[0, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[0, i] = 2;
                        changed = true;
                    }
                }

                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[1, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var pos = (i + marty[j]) % n;
                        possib[dp[0, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[1, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[1, i] = 2;
                        changed = true;
                    }

                }
            }

            var sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[0, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }
            writer.WriteLine(sb);

            sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[1, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }

            writer.WriteLine(sb);
            writer.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();

            var dp = new int[2, n - 1];
            for (var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                dp[0, n - val - 1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                dp[1, n - val - 1] = 1;
            }
            var changed = true;
            for(var k=0;k<1000;k++)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[0, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < rick.Count; j++)
                    {
                        var pos = (i + rick[j]) % n;
                        possib[dp[1, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[0, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[0, i] = 2;
                        changed = true;
                    }
                }

                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[1, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var pos = (i + marty[j]) % n;
                        possib[dp[0, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[1, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[1, i] = 2;
                        changed = true;
                    }

                }
            }

            var sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[0, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }
            writer.WriteLine(sb);

            sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[1, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }

            writer.WriteLine(sb);
            writer.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();

            var dp = new int[2, n - 1];
            for (var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                dp[0, n - val - 1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                dp[1, n - val - 1] = 1;
            }
            var changed = true;
            for(var k=0;k<10000;k++)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[0, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < rick.Count; j++)
                    {
                        var pos = (i + rick[j]) % n;
                        possib[dp[1, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[0, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[0, i] = 2;
                        changed = true;
                    }
                }

                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[1, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var pos = (i + marty[j]) % n;
                        possib[dp[0, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[1, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[1, i] = 2;
                        changed = true;
                    }

                }
            }

            var sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[0, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }
            writer.WriteLine(sb);

            sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[1, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }

            writer.WriteLine(sb);
            writer.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static List<int> rick;
        static List<int> mort;
        static int n;
        static void set(int who, int pos, int value, int[,]result, int[][] storage)
        {
            if(result[who, pos] != 0)
            {
                return;
            }
            // WIN
            if(value == 1)
            {
                result[who, pos] = 1;
                if (who == 0)
                {
                    for (var i = 0; i < mort.Count; i++)
                    {
                        storage[(who + 1) % 2][(pos + n - mort[i]) % n]--;
                        if(storage[(who + 1) % 2][(pos + n - mort[i]) % n] == 0)
                        {
                            set((who + 1) % 2, (pos + n - mort[i]) % n, 0, result, storage);
                        }
                    }
                } else
                {
                    for (var i = 0; i < rick.Count; i++)
                    {
                        storage[(who + 1) % 2][(pos + n - rick[i]) % n]--;
                        if (storage[(who + 1) % 2][(pos + n - rick[i]) % n] == 0)
                        {
                            set((who + 1) % 2, (pos + n - rick[i]) % n, 0, result, storage);
                        }
                    }
                }
            } else
            {
                result[who, pos] =2;
                if (who == 0)
                {
                    for (var i = 0; i < mort.Count; i++)
                    {
                        set((who + 1) % 2, (pos + n - mort[i]) % n, 1, result, storage);
                    }
                }
                else
                {
                    for (var i = 0; i < rick.Count; i++)
                    {
                        set((who + 1) % 2, (pos + n - rick[i]) % n, 1, result, storage);

                    }
                }
            }
        }
        static void Main(String[] args)
        {
            n = int.Parse(Console.ReadLine());
            rick = Console.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            mort = Console.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var storage = new int[2][];
            storage[0] = new int[n];
            storage[1] = new int[n];

            for(var j = 0; j < 2; j++)
            {
                for(var i = 0; i < n; i++)
                {
                    if (j == 0)
                    {
                        storage[j][i] = rick.Count;
                    } else
                    {
                        storage[j][i] = mort.Count;
                    }
                }
            }

            var result = new int[2, n];
            for (var j = 0; j < 2; j++)
            {
                result[j, n - 1] = 1;
            }
                for (var i = 0; i < rick.Count; i++)
            {
                set(0, n - rick[i]-1, 1, result, storage);
            }

            for (var i = 0; i < mort.Count; i++)
            {
                set(1, n - mort[i] - 1, 1, result, storage);
            }

            for (var j = 0; j < 2; j++)
            {
                var sb = new StringBuilder();
                for (var i = 0; i < n-1; i++)
                {
                    if (result[j, i] == 1)
                    {
                        sb.Append("Win ");
                    }
                    else if(result[j,i]==2){
                        sb.Append("Lose ");
                    } else
                    {
                        sb.Append("Loop ");
                    }
                }
                Console.WriteLine(sb);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace ConsoleApplication1.CodeForces
{
    class _403
    {
        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        static void Main(String[] args)
        {
            var n = int.Parse(reader.ReadLine());
            var rick = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();
            var marty = reader.ReadLine().Split(' ').Select(int.Parse).Skip(1).ToList();

            var dp = new int[2, n - 1];
            for (var i = 0; i < rick.Count; i++)
            {
                var val = rick[i];
                dp[0, n - val - 1] = 1;
            }

            for (var i = 0; i < marty.Count; i++)
            {
                var val = marty[i];
                dp[1, n - val - 1] = 1;
            }
            var changed = true;
            while (changed)
            {
                changed = false;
                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[0, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < rick.Count; j++)
                    {
                        var pos = (i + rick[j]) % n;
                        possib[dp[1, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[0, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[0, i] = 2;
                        changed = true;
                    }
                }

                for (var i = 0; i < n - 1; i++)
                {
                    if (dp[1, i] != 0)
                    {
                        continue;
                    }

                    var possib = new bool[3];
                    for (var j = 0; j < marty.Count; j++)
                    {
                        var pos = (i + marty[j]) % n;
                        possib[dp[0, pos]] = true;
                    }
                    if (possib[2])
                    {
                        dp[1, i] = 1;
                        changed = true;
                    }
                    else if (!possib[0])
                    {
                        dp[1, i] = 2;
                        changed = true;
                    }

                }
            }

            var sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[0, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }
            Console.WriteLine(sb);

            sb = new StringBuilder();
            for (var i = 0; i < n - 1; i++)
            {
                var val = dp[1, i];
                if (val == 1)
                {
                    sb.Append("Win");
                }
                else if (val == 2)
                {
                    sb.Append("Lose");
                }
                else
                {
                    sb.Append("Loop");
                }
                sb.Append(" ");
            }

            Console.WriteLine(sb);
        }
    }
}


import java.io.*
import java.util.*

enum class Res {
    Win, Lose, Loop
}

fun DataReader.solve(out: PrintWriter) {
    val n = nextInt()

    val s = Array(2) {
        val k = nextInt()
        (1..k).map { nextInt() }.toIntArray()
    }

    val dp = Array(n) { Array(2) { Res.Loop } }

    fun compute(id: Int) {
        val count = IntArray(n)

        for (i in 1 until n) {
            count[i] = s[1 - id].size
        }

        val queue: Queue<Int> = s[id].mapTo(LinkedList<Int>()) {
            assert(dp[n - it][id] == Res.Loop)
            dp[n - it][id] = Res.Win
            n - it
        }

        while (queue.isNotEmpty()) {
            val cur = queue.poll()

            for (d in s[1 - id]) {
                val u = (n + cur - d) % n
                if (u == 0) continue
                count[u]--
                if (count[u] == 0) {
                    assert(dp[u][1 - id] == Res.Loop)
                    dp[u][1 - id] = Res.Lose

                    for (d2 in s[id]) {
                        val v = (n + u - d2) % n
                        if (v == 0) continue
                        if (dp[v][id] != Res.Win) {
                            assert(dp[v][id] == Res.Loop)
                            dp[v][id] = Res.Win
                            queue.add(v)
                        }
                    }
                }
            }
        }
    }

    compute(0)
    compute(1)

    for (id in 0..1) {
        for (i in 1 until n) {
            out.print("${dp[i][id].name} ")
        }
        out.println()
    }
}

fun Boolean.toYesNo() = if (this) "YES" else "NO"

class DataReader(private val reader: BufferedReader) {
    var st : StringTokenizer? = null
    companion object {
        fun createFromFile(name: String) = DataReader(BufferedReader(FileReader(name)))
    }

    fun next() : String? {
        while (st == null || !st!!.hasMoreTokens()) {
            val s = reader.readLine() ?: return null
            st = StringTokenizer(s)
        }

        return st?.nextToken()
    }

    fun nextToken() = next()!!

    fun nextInt() = nextToken().toInt()
    fun nextLong() = nextToken().toLong()
    fun readIntArray(n: Int) : IntArray {
        val result = IntArray(n)
        result.indices.forEach { i -> result[i] = nextInt() }
        return result
    }

    fun readLongArray(n: Int) : LongArray {
        val result = LongArray(n)
        result.indices.forEach { i -> result[i] = nextLong() }
        return result
    }

    fun nextLine() = reader.readLine()
}

fun main(args: Array<String>) {
    val r: Reader
    val out: PrintWriter
    if (System.getProperty("ONLINE_JUDGE") == null) {
        r = FileReader("input.txt")
        out = PrintWriter("output.txt")
    } else {
        r = InputStreamReader(System.`in`)
        out = PrintWriter(System.out)
    }

    DataReader(BufferedReader(r)).solve(out)
    out.flush()
}


import java.io.*
import java.util.*
import java.math.*

//val inp = BufferedReader(FileReader ( "input.txt" ) )
val inp = BufferedReader(InputStreamReader(System.`in`))

fun isEvilGroup() : Boolean {
	val st = TreeSet<Int>()
	for ( x in inp.readLine().split(" ").map{ it.toInt() }.drop(1) ) {
		if ( st.contains(-x) )
			return false
		st.add(x)
	}
	return true
}

fun solve() : Int {
	val n = ( inp.readLine() ?: return 1 ).split(" ").map{ it.toInt() }[0]

	val a = Array<List<Int> >(2) { ArrayList<Int>() }
	for ( i in 0..1 ) a[i] = inp.readLine().split(" ").map{ it.toInt() }.drop(1)

	val mem = Array<IntArray>(2) { i -> IntArray(n) { -(a[i].size+1) } }

	val queue = LinkedList<Int>()
	for ( i in 0..1 ) {
		mem[i][n-1] = -1
		queue.add(i)
		queue.add(n-1)
	}

	while ( !queue.isEmpty() ) {
		val turn = queue.pollFirst()
		val pos = queue.pollFirst()

		val prevTurn = turn xor 1
		for ( move in a[prevTurn] ) {
			val prevPos = ( pos - move + n ) % n
			if ( mem[prevTurn][prevPos] >= -1 ) continue
			if ( mem[turn][pos] == -1 ) mem[prevTurn][prevPos] = 1
			else  mem[prevTurn][prevPos]++
			if ( mem[prevTurn][prevPos] >= -1 ) {
				queue.addLast(prevTurn);
				queue.addLast(prevPos);
			}
		}
	}

	val output = StringBuilder()
	for ( turn in 0..1 ) {
		for (pos in 0..n - 2) {
			if ( mem[turn][pos] == -1 ) output.append("Lose")
			else if ( mem[turn][pos] == 1 ) output.append("Win")
			else output.append("Loop")
			output.append(' ')
		}
		output.append("\n")
	}
	print ( output )
	return 0
}

fun main ( args : Array<String> ) {
	while (solve()==0);
}


#include<stdio.h>

char result[2][7000], s;
int n, pl[2][7000], k[2];

char rec(int a, int p){
	if (result[a][p] != ' '){
		return result[a][p];
	}
	result[a][p] = 'I';
	char c;
	int flag = 0;
	/*for (int i = 0; i < k[a]; i++){
		if (result[(a + 1) & 1][(p + pl[a][i]) % n] == 'L'){
			result[a][p] = 'W';
			return 'W';
		}
	}*/
	for (int i = 0; i < k[a]; i++){
		c = rec((a + 1) & 1, (p + pl[a][i]) % n);
		if (c == 'L'){
			result[a][p] = 'W';
			return 'W';
		} else if (c == 'I'){
			flag = 1;
		}
	}
	if (flag){
		return 'I';
	} else {
		result[a][p] = 'L';
		return 'L';
	}
}

int main(void)
{

	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		result[0][i] = ' ';
		result[1][i] = ' ';
	}
	result[0][0] = 'L';
	result[1][0] = 'L';
	//result[0][n] = '\0';
	//result[1][n] = '\0';
	scanf("%d", &k[0]);
	for (int i = 0; i < k[0]; i++){
		scanf("%d", &pl[0][i]);
		result[0][n - pl[0][i]] = 'W';
	}
	scanf("%d", &k[1]);
	for (int i = 0; i < k[1]; i++){
		scanf("%d", &pl[1][i]);
		result[1][n - pl[1][i]] = 'W';
	}
//	printf("%s\n%s\n", result[0], result[1]);
	for (int i = 1; i < n; i++){
		s = rec(0, i);
//		printf("%s\n%s\n", result[0], result[1]);
		if (s == 'W'){
			printf("Win ");
		} else if (s == 'L'){
			printf("Lose ");
		} else if (s == 'I'){
			result[0][i] = ' ';
			s = rec(0, i);
			if (s == 'W'){
				printf("Win ");
			} else if (s == 'L'){
				printf("Lose ");
			} else {
				printf("Loop ");
			}
		}
	}
	printf("\n");
	for (int i = 1; i < n; i++){
		s = rec(1, i);
		if (s == 'W'){
			printf("Win ");
		} else if (s == 'L'){
			printf("Lose ");
		} else if (s == 'I'){
			result[1][i] = ' ';
			s = rec(1, i);
			if (s == 'W'){
				printf("Win ");
			} else if (s == 'L'){
				printf("Lose ");
			} else {
				printf("Loop ");
			}
		}
	}
}


#include<stdio.h>

char result[2][7100], s;
int n, pl[2][7100], k[2];

char rec(int a, int p){
	if (result[a][p] != ' '){
		return result[a][p];
	}
	result[a][p] = 'I';
	char c;
	int flag = 0;
	for (int i = 0; i < k[a]; i++){
		c = rec((a + 1) & 1, (p + pl[a][i]) % n);
		if (c == 'L'){
			result[a][p] = 'W';
			return 'W';
		} else if (c == 'I'){
			flag = 1;
		}
	}
	if (flag){
		return 'I';
	} else {
		result[a][p] = 'L';
		return 'L';
	}
}

int main(void)
{

	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		result[0][i] = ' ';
		result[1][i] = ' ';
	}
	result[0][0] = 'L';
	result[1][0] = 'L';
	scanf("%d", &k[0]);
	for (int i = 0; i < k[0]; i++){
		scanf("%d", &pl[0][i]);
		result[0][n - pl[0][i]] = 'W';
	}
	scanf("%d", &k[1]);
	for (int i = 0; i < k[1]; i++){
		scanf("%d", &pl[1][i]);
		result[1][n - pl[1][i]] = 'W';
	}
	for (int i = 1; i < n; i++){
		s = rec(0, i);
		if (s == 'W'){
			printf("Win ");
		} else if (s == 'L'){
			printf("Lose ");
		} else {
			printf("Loop ");
		}
	}
	printf("\n");
	for (int i = 1; i < n; i++){
		s = rec(1, i);
		if (s == 'W'){
			printf("Win ");
		} else if (s == 'L'){
			printf("Lose ");
		} else {
			printf("Loop ");
		}
	}
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,ta,tb,par[MAX],anc[MAX],cnt[MAX],ans[MAX];
vector<int> va[MAX],vb[MAX],vc[MAX];
bool v[MAX];

int find(int a){
	if(par[a]==a)return a;
	return par[a]=find(par[a]);
}

void dfs1(int a,int b){
	par[a]=a;
	anc[a]=a;
	F1(c,0,va[a].size())if(va[a][c]!=b){
		dfs1(va[a][c],a);
		par[find(va[a][c])]=find(a);
		anc[par[a]]=a;
	}
	v[a]=1;
	F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[anc[find(vb[a][c])]]-=2;
}

int dfs2(int a,int b){
	F1(c,0,va[a].size())if(va[a][c]!=b){
		int tt=dfs2(va[a][c],a);
		cnt[a]+=tt;
		ans[vc[a][c]]=tt;
	}
	return cnt[a];
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		va[ta].pb(tb);
		va[tb].pb(ta);
		vc[ta].pb(a);
		vc[tb].pb(a);
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		vb[ta].pb(tb);
		vb[tb].pb(ta);
		cnt[ta]++;
		cnt[tb]++;
	}
	dfs1(1,0);
	dfs2(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,ta,tb,par[MAX],anc[MAX],cnt[MAX],ans[MAX];
vector<int> va[MAX],vb[MAX],vc[MAX];
bool v[MAX];

int find(int a){
	if(par[a]==a)return a;
	return par[a]=find(par[a]);
}

void dfs1(int a,int b){
	par[a]=a;
	anc[a]=a;
	F1(c,0,va[a].size())if(va[a][c]!=b){
		dfs1(va[a][c],a);
		par[find(va[a][c])]=find(a);
		anc[par[a]]=a;
	}
	v[a]=1;
	F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[anc[find(vb[a][c])]]-=2;
}

int dfs2(int a,int b){
	F1(c,0,va[a].size())if(va[a][c]!=b){
		int tt=dfs2(va[a][c],a);
		cnt[a]+=tt;
		ans[vc[a][c]]=tt;
	}
	return cnt[a];
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		va[ta].pb(tb);
		va[tb].pb(ta);
		vc[ta].pb(a);
		vc[tb].pb(a);
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		if(ta==tb)continue;
		vb[ta].pb(tb);
		vb[tb].pb(ta);
		cnt[ta]++;
		cnt[tb]++;
	}
	dfs1(1,0);
	dfs2(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,ta,tb,par[MAX]/*,anc[MAX]*/,cnt[MAX],ans[MAX];
vector<int> va[MAX],vb[MAX],vc[MAX];
bool v[MAX];

int find(int a){
	if(par[a]==a)return a;
	return par[a]=find(par[a]);
}

void dfs1(int a,int b){
	par[a]=anc[a]=a;
	F1(c,0,va[a].size())if(va[a][c]!=b){
		dfs1(va[a][c],a);
		par[find(va[a][c])]=a;//find(a);
		//anc[par[a]]=a;
	}
	v[a]=1;
	//F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[anc[find(vb[a][c])]]-=2;
	F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[find(vb[a][c])]-=2;
}

int dfs2(int a,int b){
	F1(c,0,va[a].size())if(va[a][c]!=b){
		int tt=dfs2(va[a][c],a);
		cnt[a]+=tt;
		ans[vc[a][c]]=tt;
	}
	return cnt[a];
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		va[ta].pb(tb);
		va[tb].pb(ta);
		vc[ta].pb(a);
		vc[tb].pb(a);
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		if(ta==tb)continue;
		vb[ta].pb(tb);
		vb[tb].pb(ta);
		cnt[ta]++;
		cnt[tb]++;
	}
	dfs1(1,0);
	dfs2(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,ta,tb,par[MAX],anc[MAX],cnt[MAX],ans[MAX];
vector<int> va[MAX],vb[MAX],vc[MAX];
bool v[MAX];

int find(int a){
	if(par[a]==a)return a;
	return par[a]=find(par[a]);
}

int dfs(int a,int b){
	par[a]=a;
	anc[a]=a;
	F1(c,0,va[a].size())if(va[a][c]!=b){
		int tt=dfs(va[a][c],a);
		cnt[a]+=tt;
		ans[vc[a][c]]=tt;
		par[find(va[a][c])]=find(a);
		anc[par[a]]=a;
	}
	v[a]=1;
	F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[anc[find(vb[a][c])]]-=2;
	return cnt[a];
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		va[ta].pb(tb);
		va[tb].pb(ta);
		vc[ta].pb(a);
		vc[tb].pb(a);
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		if(ta==tb)continue;
		vb[ta].pb(tb);
		vb[tb].pb(ta);
		cnt[ta]++;
		cnt[tb]++;
	}
	dfs(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,ta,tb,par[MAX]/*,anc[MAX]*/,cnt[MAX],ans[MAX];
vector<int> va[MAX],vb[MAX],vc[MAX];
bool v[MAX];

int find(int a){
	if(par[a]==a)return a;
	return par[a]=find(par[a]);
}

void dfs1(int a,int b){
	par[a]/*=anc[a]*/=a;
	F1(c,0,va[a].size())if(va[a][c]!=b){
		dfs1(va[a][c],a);
		par[find(va[a][c])]=a;//find(a);
		//anc[par[a]]=a;
	}
	v[a]=1;
	//F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[anc[find(vb[a][c])]]-=2;
	F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[find(vb[a][c])]-=2;
}

int dfs2(int a,int b){
	F1(c,0,va[a].size())if(va[a][c]!=b){
		int tt=dfs2(va[a][c],a);
		cnt[a]+=tt;
		ans[vc[a][c]]=tt;
	}
	return cnt[a];
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		va[ta].pb(tb);
		va[tb].pb(ta);
		vc[ta].pb(a);
		vc[tb].pb(a);
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		if(ta==tb)continue;
		vb[ta].pb(tb);
		vb[tb].pb(ta);
		cnt[ta]++;
		cnt[tb]++;
	}
	dfs1(1,0);
	dfs2(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,ta,tb,par[MAX],anc[MAX],cnt[MAX],ans[MAX];
vector<int> va[MAX],vb[MAX],vc[MAX];
bool v[MAX];

int find(int a){
	if(par[a]==a)return a;
	return par[a]=find(par[a]);
}

void dfs1(int a,int b){
	par[a]=anc[a]=a;
	F1(c,0,va[a].size())if(va[a][c]!=b){
		dfs1(va[a][c],a);
		par[find(va[a][c])]=a;//find(a);
		anc[par[a]]=a;
	}
	v[a]=1;
	F1(c,0,vb[a].size())if(v[vb[a][c]])cnt[anc[find(vb[a][c])]]-=2;
}

int dfs2(int a,int b){
	F1(c,0,va[a].size())if(va[a][c]!=b){
		int tt=dfs2(va[a][c],a);
		cnt[a]+=tt;
		ans[vc[a][c]]=tt;
	}
	return cnt[a];
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		va[ta].pb(tb);
		va[tb].pb(ta);
		vc[ta].pb(a);
		vc[tb].pb(a);
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		if(ta==tb)continue;
		vb[ta].pb(tb);
		vb[tb].pb(ta);
		cnt[ta]++;
		cnt[tb]++;
	}
	dfs1(1,0);
	dfs2(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
    return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,m,at,i[MAX],ta,tb,cnt[MAX],ans[MAX];
vector<int> y[MAX],x[MAX];
pair<int,int> z[19][MAX*2]; //<depth,node>

void dfs(int a,int b,int c){
	z[0][i[a]=at++]=make_pair(c,a);
	F1(d,0,y[a].size())if(y[a][d]!=b){
		dfs(y[a][d],a,c+1);
		z[0][at++]=make_pair(c,a);
	}
}

pair<int,int> f1(int a,int b,int c,int d){
	if(a==f(c,d)&&b==f(c,d+1))return z[c][d];
	c--;
	d=d*2+1;
	if(b<=f(c,d))return f1(a,b,c,d-1);
	if(a>=f(c,d))return f1(a,b,c,d);
	return min(f1(a,f(c,d),c,d-1),f1(f(c,d),b,c,d));
}

int lca(int a,int b){
	return f1(min(i[a],i[b]),max(i[a],i[b])+1,18,0).second;
}

void dfs1(int a,int b){
	F1(c,0,y[a].size())if(y[a][c]!=b){
		dfs1(y[a][c],a);
		cnt[a]+=cnt[y[a][c]];
		ans[x[a][c]]=cnt[y[a][c]];
	}
}

int main(){
	scanf("%d",&n);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		y[ta].pb(tb),y[tb].pb(ta);
		x[ta].pb(a),x[tb].pb(a);
	}
	dfs(1,0,0);
	F1(a,1,19)for(int b=0;f(a,b)<at;b++){
		if(f(a-1,b*2+1)<at)z[a][b]=min(z[a-1][b*2],z[a-1][b*2+1]);
		else z[a][b]=z[a-1][b*2];
	}

	scanf("%d",&m);
	while(m--){
		scanf("%d%d",&ta,&tb);
		cnt[ta]++,cnt[tb]++,cnt[lca(ta,tb)]-=2;
	}
	dfs1(1,0);
	F1(a,1,n)printf("%d%c",ans[a],a==n-1?'\n':' ');
	//system("pause");
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[19][100055],level[100055];
int size,first[100055],next[200055];
int d[100055],res[100055];

struct edge {
    int to,idd;
};

edge e[200055];

void add_edge(int from,int to,int id) {
    next[++size]=first[from];
    first[from]=size;
    e[size]=(edge){to,id};
}
void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    repl(i,first[id],next) {
        int to=e[i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,17) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[par[i][v]][v];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,18) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,18) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int par) {
    repl(i,first[id],next) {
        int to=e[i].to,idd=e[i].idd;
        if (to==par) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        add_edge(x,y,i);
        add_edge(y,x,i);
    }
    lca_init();
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[20][100055],level[100055];
int size,first[100055],next[200055];
int d[100055],res[100055];

struct edge {
    int to,idd;
};

edge e[200055];

void add_edge(int from,int to,int id) {
    next[++size]=first[from];
    first[from]=size;
    e[size]=(edge){to,id};
}
void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    repl(i,first[id],next) {
        int to=e[i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,17) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[par[i][v]][v];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,18) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,18) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int par) {
    repl(i,first[id],next) {
        int to=e[i].to,idd=e[i].idd;
        if (to==par) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        add_edge(x,y,i);
        add_edge(y,x,i);
    }
    lca_init();
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[19][100055],level[100055];
int size,first[100055],next[200055];
int d[100055],res[100055];

struct edge {
    int to,idd;
};

edge e[200055];

void add_edge(int from,int to,int id) {
    next[++size]=first[from];
    first[from]=size;
    e[size]=(edge){to,id};
}
void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    repl(i,first[id],next) {
        int to=e[i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,16) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[par[i][v]][v];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,17) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,17) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int p) {
    repl(i,first[id],next) {
        int to=e[i].to,idd=e[i].idd;
        if (to==p) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        add_edge(x,y,i);
        add_edge(y,x,i);
    }
    lca_init();
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[20][100055],level[100055];
int d[100055],res[100055];

struct edge {
    int to,idd;
};

vector<edge> e[100055];

void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    rep(i,e[id].size()) {
        int to=e[id][i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,17) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[par[i][v]][v];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,18) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,18) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int par) {
    rep(i,e[id].size()) {
        int to=e[id][i].to,idd=e[id][i].idd;
        if (to==par) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        e[x].pb((edge){y,i});
        e[y].pb((edge){x,i});
    }
    lca_init();
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[19][200055],level[200055];
int size,first[200055],next[400055];
int d[200055],res[200055];

struct edge {
    int to,idd;
};

edge e[400055];

void add_edge(int from,int to,int id) {
    next[++size]=first[from];
    first[from]=size;
    e[size]=(edge){to,id};
}
void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    repl(i,first[id],next) {
        int to=e[i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,17) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[par[i][v]][v];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,18) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,18) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int par) {
    repl(i,first[id],next) {
        int to=e[i].to,idd=e[i].idd;
        if (to==par) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        add_edge(x,y,i);
        add_edge(y,x,i);
    }
    printf("diu");
    lca_init();
    printf("wtfdiu");
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    printf("HOLYSHIT");
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[20][400055],level[400055];
int size,first[400055],next[800055];
int d[400055],res[400055];

struct edge {
    int to,idd;
};

edge e[800055];

void add_edge(int from,int to,int idd) {
    next[++size]=first[from];
    first[from]=size;
    e[size]=(edge){to,idd};
}
void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    repl(i,first[id],next) {
        int to=e[i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,17) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[par[i][v]][v];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,18) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,18) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int par) {
    repl(i,first[id],next) {
        int to=e[i].to,idd=e[i].idd;
        if (to==par) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        add_edge(x,y,i);
        add_edge(y,x,i);
    }
    lca_init();
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}


#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <deque>
#include <vector>
#include <map>
#include <cmath>
#include <cstdlib>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cstring>
#include <climits>
#include <cctype>
#include <utility>
using namespace std;

#define ft first
#define sd second
#define pb push_back
#define endl '\n'
#define cpy(a,e) memcpy(a,e,sizeof(e))
#define clr(a,e) memset(a,e,sizeof(a))
#define iter(c) __typeof((c).begin())
#define tr(c,i) for (iter(c) i=(c).begin();i!=(c).end();i++)
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define repd(i,n) for (int (i)=(n)-1;(i)>=0;i--)
#define reps(i,s,e) for (int (i)=(s);(i)<=(e);i++)
#define repds(i,s,e) for (int (i)=(s);(i)>=(e);i--)
#define repl(i,s,e) for (int (i)=(s);(i);i=e[i])

int n,k,par[19][100055],level[100055];
int size,first[100055],next[200055];
int d[100055],res[100055];

struct edge {
    int to,idd;
};

edge e[200055];

void add_edge(int from,int to,int id) {
    next[++size]=first[from];
    first[from]=size;
    e[size]=(edge){to,id};
}
void dfs(int id,int p,int d) {
    level[id]=d;
    par[0][id]=p;
    repl(i,first[id],next) {
        int to=e[i].to;
        if (to==p) continue;
        dfs(to,id,d+1);
    }
}
void lca_init() {
    dfs(0,-1,0);
    rep(i,16) {
        rep(v,n) {
            if (par[i][v]==-1) par[i+1][v]=-1;
            else par[i+1][v]=par[i][par[i][v]];
        }
    }
}
int lca(int u,int v) {
    if (level[u]>level[v]) swap(u,v);
    rep(i,17) {
        if (((level[v]-level[u])>>i)&1) {
            v=par[i][v];
        }
    }
    if (u==v) return u;
    repd(i,17) {
        if (par[i][u]!=par[i][v]) {
            u=par[i][u];
            v=par[i][v];
        }
    }
    return par[0][u];
}
void solve(int id,int p) {
    repl(i,first[id],next) {
        int to=e[i].to,idd=e[i].idd;
        if (to==p) continue;
        solve(to,id);
        res[idd]=d[to];
        d[id]+=d[to];
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int x,y;
    rep(i,n-1) {
        cin >> x >> y;
        x--;y--;
        add_edge(x,y,i);
        add_edge(y,x,i);
    }
    lca_init();
    cin >> k;
    while(k--) {
        cin >> x >> y;
        x--;y--;
        int l=lca(x,y);
        d[l]-=2;
        d[x]++;d[y]++;
    }
    solve(0,-1);
    rep(i,n-1) {
        if (i) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}