BEGIN {$| = 1;}

use HTML::Content::Extractor;

my (@tables, @standard);
push @tables, q~<table><thead><tr><th>title 1</th></tr><tr><td>title 2</td></tr></thead><tbody><tr><th>body 1</th></tr><tr><td>body 2</td></tr></tbody><tfoot><tr><th>foot 1</th></tr><tr><td>foot 2</td></tr></tfoot></table>~;
push @tables, q~<table><div>div test</div><thead><div>div test</div><tr><div>div test</div><th>title 1</th><div>test</div></tr><div>test</div><tr><div>test</div><td>title 2</td><div>test</div></tr><div>test</div></thead><div>test</div><tbody><div>test</div><tr><div>test</div><th>body 1</th><div>test</div></tr><div>test</div><tr><div>test</div><td>body 2</td><div>test</div></tr><div>test</div></tbody><div>test</div><tfoot><div>test</div><tr><div>test</div><th>foot 1</th><div>test</div></tr><div>test</div><tr><div>test</div><td>foot 2</td><div>test</div></tr><div>test</div></tfoot><div>test</div></table>~;
push @tables, q~<table><div>div test<thead><div>div test<tr><div>div test<th>title 1</th><div>test</tr><div>test<tr><div>test<td>title 2</td><div>test</tr><div>test</thead><div>test<tbody><div>test<tr><div>test<th>body 1</th><div>test</tr><div>test<tr><div>test<td>body 2</td><div>test</tr><div>test</tbody><div>test<tfoot><div>test<tr><div>test<th>foot 1</th><div>test</tr><div>test<tr><div>test<td>foot 2</td><div>test</tr><div>test</tfoot><div>test</table>~;
push @tables, q~<table><span>span test</span><thead><span>span test</span><tr><span>span test</span><th>title 1</th><span>test</span></tr><span>test</span><tr><span>test</span><td>title 2</td><span>test</span></tr><span>test</span></thead><span>test</span><tbody><span>test</span><tr><span>test</span><th>body 1</th><span>test</span></tr><span>test</span><tr><span>test</span><td>body 2</td><span>test</span></tr><span>test</span></tbody><span>test</span><tfoot><span>test</span><tr><span>test</span><th>foot 1</th><span>test</span></tr><span>test</span><tr><span>test</span><td>foot 2</td><span>test</span></tr><span>test</span></tfoot><span>test</span></table>~;
push @tables, q~<table><span>span test<thead><span>span test<tr><span>span test<th>title 1</th><span>test</tr><span>test<tr><span>test<td>title 2</td><span>test</tr><span>test</thead><span>test<tbody><span>test<tr><span>test<th>body 1</th><span>test</tr><span>test<tr><span>test<td>body 2</td><span>test</tr><span>test</tbody><span>test<tfoot><span>test<tr><span>test<th>foot 1</th><span>test</tr><span>test<tr><span>test<td>foot 2</td><span>test</tr><span>test</tfoot><span>test</table>~;
push @tables, q~<table><a>test<a><thead><a>test<a><tr><a>test<a><th>title 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>title 2</td><a>test<a></tr><a>test<a></thead><a>test<a><tbody><a>test<a><tr><a>test<a><th>body 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>body 2</td><a>test<a></tr><a>test<a></tbody><a>test<a><tfoot><a>test<a><tr><a>test<a><th>foot 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>foot 2</td><a>test<a></tr><a>test<a></tfoot><a>test<a></table>~;
push @tables, q~<table><a>test<a><a>test<a><tr><a>test<a><th>title 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>title 2</td><a>test<a></tr><a>test<a></thead><a>test<a><a>test<a><tr><a>test<a><th>body 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>body 2</td><a>test<a></tr><a>test<a></tbody><a>test<a><a>test<a><tr><a>test<a><th>foot 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>foot 2</td><a>test<a></tr><a>test<a></tfoot><a>test<a></table>~;
push @tables, q~<table><a>test<a><a>test<a><a>test<a><th>title 1</th><a>test<a><a>test<a><a>test<a><td>title 2</td><a>test<a><a>test<a></thead><a>test<a><a>test<a><a>test<a><th>body 1</th><a>test<a></tr><a>test<a><a>test<a><td>body 2</td><a>test<a></tr><a>test<a></tbody><a>test<a><a>test<a><tr><a>test<a><th>foot 1</th><a>test<a></tr><a>test<a><tr><a>test<a><td>foot 2</td><a>test<a></tr><a>test<a></tfoot><a>test<a></table>~;
push @tables, q~<table><tbody><td>rgreg <table><tbody>sdfsfsf<td>dgdgf</td><div>sdasdad</table> </td><span>popopo</table><div>asdasdas</div><div>asdasdas</div>~;
push @tables, q~<table><tbody><td> rgreg <div><table><tbody><td>dgdgf</td><div><table><tbody><td>dgdgf</td></table></table> </td></table><div>asdasdas</div><div>asdasdas</div>~;
push @tables, q~<p>asdsad<table>dsff<table>sdfsfsf<td>dgdgf</td></table> </td></table><div>asdasdas</div><div>asdasdas</div>~;
push @tables, q~<table><td>dsff<p>sdfsf<table>sdfsfsf<td>dgdgf</td></table> </td></table><div>asdasdas</div><div>asdasdas</div>~;
push @tables, q~<table><tr><tbody>sdfsfdssdf<div>sfsfsfsd<td><thead><tr><td>dfd <div><div><div><td> dfdf</td></tr><div>asdasdas</div><div>asdasdas</div></table>~;


push @standard,
[
        { name => "table", level => 1},
                { name => "thead", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tfoot", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "table", level => 1},
                { name => "thead", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tfoot", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "table", level => 1},
                { name => "thead", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tfoot", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "table", level => 1},
                { name => "thead", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tfoot", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "table", level => 1},
                { name => "thead", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tfoot", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "table", level => 1},
                { name => "thead", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tfoot", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "a", level => 1}, { name => " ", level => 2},{ name => "a", level => 1},
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                                { name => "th", level => 4}, { name => " ", level => 5},
                                { name => "td", level => 4}, { name => " ", level => 5},
                                { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3}, { name => "th", level => 4}, { name => " ", level => 5},
                        { name => "tr", level => 3}, { name => "td", level => 4}, { name => " ", level => 5}
],
[
        { name => "span", level => 1}, { name => " ", level => 2},
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                                { name => "td", level => 4},
                                        { name => " ", level => 5}, { name => " ", level => 5},
                                        { name => "div", level => 5}, { name => " ", level => 6},
                                        { name => "table", level => 5},
                                                { name => "tbody", level => 6},
                                                        { name => "tr", level => 7}, { name => "td", level => 8}, { name => " ", level => 9},
        { name => "div", level => 1},
                { name => " ", level => 2},
        { name => "div", level => 1},
                { name => " ", level => 2},
],
[
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                                { name => "td", level => 4},
                                        { name => " ", level => 5},
                                        { name => "div", level => 5},
                                                { name => "div", level => 6},
                                                { name => "table", level => 6},
                                                        { name => "tbody", level => 7},
                                                                { name => "tr", level => 8}, { name => "td", level => 9}, { name => " ", level => 10},
                                                { name => "table", level => 6},
                                                        { name => "tbody", level => 7},
                                                                { name => "tr", level => 8}, { name => "td", level => 9}, { name => " ", level => 10},
        { name => "div", level => 1},
                { name => " ", level => 2},
        { name => "div", level => 1},
                { name => " ", level => 2},
],
[
        { name => "p", level => 1}, { name => " ", level => 2},
        { name => " ", level => 1},
        { name => "table", level => 1},
        { name => " ", level => 1},
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                                { name => "td", level => 4},
                                        { name => " ", level => 5},
        { name => "div", level => 1},
                { name => " ", level => 2},
        { name => "div", level => 1},
                { name => " ", level => 2},
],
[
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                                { name => "td", level => 4},
                                        { name => " ", level => 5},
                                        { name => "p", level => 5}, { name => " ", level => 6},
                                        { name => " ", level => 5},
                                        { name => "table", level => 5},
                                                { name => "tbody", level => 6},
                                                        { name => "tr", level => 7},
                                                                { name => "td", level => 8},
                                                                        { name => " ", level => 9},
        { name => "div", level => 1},
                { name => " ", level => 2},
        { name => "div", level => 1},
                { name => " ", level => 2},
],
[
        { name => " ", level => 1},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "div", level => 1}, { name => " ", level => 2},
        { name => "table", level => 1},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                { name => "tbody", level => 2},
                        { name => "tr", level => 3},
                                { name => "td", level => 4},
                { name => "thead", level => 2},
                        { name => "tr", level => 3},
                                { name => "td", level => 4},
                                        { name => " ", level => 5},
                                        { name => "div", level => 5},
                                                { name => "div", level => 6},
                                                        { name => "div", level => 7},
                                { name => "td", level => 4},
                                        { name => " ", level => 5}
]
;

print "1..", scalar @tables, "\n";


my $obj = HTML::Content::Extractor->new();

foreach my $i (0..$#tables) {
        $obj->build_tree($tables[$i]);
        my $tree = $obj->get_tree();
        
        if( scalar(@$tree) - 3 != scalar @{$standard[$i]} ) {
                print "not ok ", $i+1, "\n"; next;
        }
        
        my $res = 1;
        foreach my $e (3..$#$tree) {
                $standard[$i]->[$e - 3]->{level} += 2;
                
                if($standard[$i]->[$e - 3]->{name} ne $tree->[$e]->{name} || $standard[$i]->[$e - 3]->{level} ne $tree->[$e]->{level}) {
                        $res = 0; last;
                }
        }
        
        if($res) {
                print "ok ", $i+1, "\n";
        }
        else {
                print "not ok ", $i+1, "\n";
        }
}
