Fizz Buzz.. Crackle Pop! (Generalized Fizz Buzz) We've all heard of the ol' Fizz Buzz problem, but what happens when you try to apply it with more factors? Fizz Buzz Crackle Pop!
The Challenge
Write a full program that takes an integer input n, then n tuples containing an integer and a string, then another integer (&gt;1) k, as such:
 n int1 str1 int2 str2 (...) intn strn k

You can take this line from either command line or STDIN.
Then, for all integers 1 to k, if it is divisible by any of int1, int2...intn, output all corresponding strs in the input order, followed by a newline. If it isn't, then just output the integer, followed by a newline.
For example, with input
3 2 Fizz 3 Buzz 5 Crackle 10

we get
1
Fizz
Buzz
Fizz
Crackle
FizzBuzz
7
Fizz
Buzz
FizzCrackle

But with input (notice the order change)
3 3 Buzz 2 Fizz 5 Crackle 10

we get
1
Fizz
Buzz
Fizz
Crackle
BuzzFizz
7
Fizz
Buzz
FizzCrackle

Optional trailing newline is acceptable.
Shortest code in bytes wins.
Edits:
Obviously I've missed out a lot, sorry.

Inputs from console and STDIN, anything else gets +5 bytes (:c) anywhere
Full programs please.
Assume non-empty strings for strs
No guarantees for uniqueness of ints

Sample C++ program (limited at 20 because I'm lazy):
#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

int main() {
  string names[20];
  int mods[20], n, max;
  cin &gt;&gt; max &gt;&gt; n;
  for (int i=0; i&lt;n; i++) {
    cin &gt;&gt; mods[i] &gt;&gt; names[i];
  }
  for (int i=1; i&lt;=max; i++) {
    bool found = false;

    for (int j=0; j&lt;n; j++) {
      if (i % mods[j] == 0) {
        found = true;
        cout &lt;&lt; names[j];
      }
    }
    if (!found)
     cout &lt;&lt; i;
    cout &lt;&lt; endl;
  }

  return 0;
}
JavaScript (ES6), 90 bytes

Generates a leading newline.

f=(a,i=a.pop())=&gt;i?f(a,i-1)+`
`+(a.map((_,j)=&gt;++j&gt;a[0]|i%a[j*2-1]?'':a[j*2]).join``||i):''


Test



f=(a,i=a.pop())=&gt;i?f(a,i-1)+`
`+(a.map((_,j)=&gt;++j&gt;a[0]|i%a[j*2-1]?'':a[j*2]).join``||i):''

console.log(f([3, 2, 'Fizz', 3, 'Buzz', 5, 'Crackle', 10]))
console.log(f([3, 3, 'Buzz', 2, 'Fizz', 5, 'Crackle', 10]))