Is this word on the boggle board? Introduction

After a day of drinking and watching the world cup, you sit down to play friendly game of boggle. Tempers rise as you are accused of wasting everyone's time with nonsense words that aren't even on the board! You may be seeing double, but surely you're thinking straight enough to write a program that will verify that your words are on the board.

Your Task

Write a program, script, or function that takes a boggle board and a word as input, and returns True if the word is on the board and False if the word isn't.

The input will be in the form of six \n delimited lines. The first five lines will comprise the 5x5 boggle board and will each contain five capital letters. The sixth line will contain the word-in-question, also in all capital letters.

Sample input:

AJNES
TNFTR
LSAIL
UDNEX
EQGMM
DAFTER


The output can be anything that unambiguously signifies True or False in your programming language of choice and adheres to standard conventions of zero, null, and empty signifying False.

Sample output for above input:

1


I/O Guidelines


The input may be read from stdin, and answer output to stdout.


Or


The input may be a single string argument to a function, and answer be the return value of that function.


Boggle Rules


A word is 'on the board' if you can construct the word via a path of consecutive, adjacent, non-repeating tiles on the board. 
A tile is considered adjacent to the eight tiles that surround it (diagonal paths are allowed). Tiles on the edge of the board are adjacent to only five tiles. Tiles in the corner are adjacent to only three.
Consecutive letters in the word must be adjacent, the ith letter in the word must be adjacent to the i-1th and i+1th.
A letter may appear in a word more than once, but you cannot use the same square on the boggle board more than once per word.
The online boggle site wordsplay.net may be useful if you have never played boggle before, but want to get a feel for these rules.


Unlike regular boggle:


You do NOT have to worry about the word being a valid English word.
There will be NO Qu single tile.
The word-in-question may be of any length > 0


Example

On the board of

AJNES
TNFTR
LSAIL
UDNEX
EQGMM


These words should return True: FATE, DATING, STANDS, LIFTS.

These words should return False: SADDEN, SULTANS, EXIST, SUEDE, QUEST

This is a code-golf challenge, so shortest code wins!
Javascript (E6) 137 160 175 190

Less than 2*Golfscript. Moral victory ...

F=a=&gt;[...a].some((e,p,b)=&gt;(Q=(p,n)=&gt;p&gt;29||b[p]!=b[n]||(b.r|=!b[++n])||(b[p]=b[n+~[1,5,6,7].map(q=&gt;Q(p+q,n)|Q(p-q,n),b[p]=0)]))(p,30)&amp;b.r)


Edit Golfed code reorganization. Again and again

Ungolfed Last version, a bit tricky to follow

F = a =&gt; 
  [...a] // input string to array, 30 chars of board then the target word
  .some ( // use some to scan the board, return true when found
      (e,p,b)=&gt; // params to callback: element, position, complete array 
      (         // NB array b has no .r property, so use it for return value (it's undefined at start) 
        Q = (p,n) =&gt;         // Scan function, p=position in board, n=nth char of target word
          p &gt; 29 ||          // Chaek if going outside the board to the target word
          b[p] != b[n] ||    // if invalid char at current position, return
          (b.r |= !b[++n]) ||  // if at end of target, set r to 1 and return (also increment n )
          (                  // else... (NB next tree lines are coalesced in golfed code)
            b[p] = 0,        // remove current char (to avoid reusing) 
            [1,5,6,7].map( q =&gt; Q(p+q,n)|Q(p-q,n)), // recursive call for + - 1,5,6,7
            b[p] = b[n-1]    // put current char into array again 
          )
      )(p,30) &amp; b.r // initial position 0 in target word is 30 in the array
  ) 


Ungolfed First version , should be clearer

F = a =&gt; (
  b = a.split('\n'),
  w = b.pop(),
  r = 0,
  Q = (p, n) =&gt; 
    (r |= !w[n]) || 
    (
      b[p] = 0,
      [1,5,6,7,-1,-5,-6,-7].map( q =&gt; b[q+=p]==w[n] &amp;&amp; Q(q,n+1)),
      b[p] = w[n-1]
    ),
  b = [...b+''],
  b.map((e, p) =&gt; e==w[0] &amp;&amp; Q(p,1)),
  r
)


Usage 

F("AJNES\nTNFTR\nLSAIL\nUDNEX\nEQGMM\nLIFTS\nDAFTER")


Test

['DAFTER', 'STANDS', 'LIFTS', 'FATE', 'DATING' ,
 'SADDEN','SULTANS', 'EXIST', 'SUEDE', 'QUEST']
.map(w =&gt; [w, F("AJNES\nTNFTR\nLSAIL\nUDNEX\nEQGMM\n" +w)])


Output:

[["DAFTER", true], ["STANDS", true], ["LIFTS", true], ["FATE", true], ["DATING", true], 
["SADDEN", false], ["SULTANS", false], ["EXIST", false], ["SUEDE", false], ["QUEST", false]]