# Original description:
Unnormalized-form data is troublesome. [unf.zip](https://problem.harekaze.com/fefca251bfb1518b50fb928c91612587c899e27a00ff58e4292fe15c0c838820/unf/unf.zip)
# Problem:
The zip file contains a (Postgre) SQL file which creates two tables dic and rel and a (nice recursive) function flag(). Also a lot of data is inserted into those tables. The tables use TEXT[] arrays of size 3, which is a nice addition. When the function is called, you just get HarekazeCFP{} without the flag.
# Solution:The dic table is a dictionary (which combination of letters/code is which letter). The rel table shows which code follows some other code in the solution. The FLAG() function defines an addtional table that resembles the ordering of letters in the solution. When compared to the actual data in rel some of the codes in the ordering were out of order. When changing these values, the solution emerges. Here is the code (the original values are given in the comment):
```DROP FUNCTION flag();DROP TABLE dic, rel;
CREATE TABLE dic (a TEXT[], c TEXT);ALTER TABLE dic OWNER TO postgres;
CREATE TABLE rel (s TEXT[], d TEXT[]);ALTER TABLE rel OWNER TO postgres;
INSERT INTO dic(a, c) VALUES('{d,B,7}','H');INSERT INTO dic(a, c) VALUES('{b,A,4}','.');INSERT INTO dic(a, c) VALUES('{b,H,1}','=');INSERT INTO dic(a, c) VALUES('{d,A,5}','p');INSERT INTO dic(a, c) VALUES('{b,A,3}','k');INSERT INTO dic(a, c) VALUES('{c,A,1}','r');INSERT INTO dic(a, c) VALUES('{b,C,3}','T');INSERT INTO dic(a, c) VALUES('{c,B,2}','_');INSERT INTO dic(a, c) VALUES('{b,E,2}','w');INSERT INTO dic(a, c) VALUES('{d,E,6}','N');INSERT INTO dic(a, c) VALUES('{c,A,4}','y');INSERT INTO dic(a, c) VALUES('{b,D,3}','_');INSERT INTO dic(a, c) VALUES('{c,D,5}','!');INSERT INTO dic(a, c) VALUES('{d,G,2}','q');INSERT INTO dic(a, c) VALUES('{a,G,5}','n');INSERT INTO dic(a, c) VALUES('{d,B,5}','e');INSERT INTO dic(a, c) VALUES('{b,H,3}','5');INSERT INTO dic(a, c) VALUES('{a,G,1}','p');INSERT INTO dic(a, c) VALUES('{c,D,1}','*');INSERT INTO dic(a, c) VALUES('{d,E,7}','e');INSERT INTO dic(a, c) VALUES('{c,E,4}','c');INSERT INTO dic(a, c) VALUES('{b,G,6}','e');INSERT INTO dic(a, c) VALUES('{a,7,A}','#');INSERT INTO dic(a, c) VALUES('{b,1,G}','2');INSERT INTO dic(a, c) VALUES('{a,4,G}','q');INSERT INTO dic(a, c) VALUES('{d,2,E}','d');INSERT INTO dic(a, c) VALUES('{d,6,C}','{');INSERT INTO dic(a, c) VALUES('{c,1,F}','*');INSERT INTO dic(a, c) VALUES('{c,2,E}','V');INSERT INTO dic(a, c) VALUES('{NULL,D,2}','|');INSERT INTO dic(a, c) VALUES('{d,B,1}','r');INSERT INTO dic(a, c) VALUES('{b,H,2}','p');INSERT INTO dic(a, c) VALUES('{c,H,2}','q');INSERT INTO dic(a, c) VALUES('{b,G,2}','i');INSERT INTO dic(a, c) VALUES('{a,H,7}','V');INSERT INTO dic(a, c) VALUES('{c,C,5}','$');INSERT INTO dic(a, c) VALUES('{a,C,5}','n');INSERT INTO dic(a, c) VALUES('{d,F,2}','z');INSERT INTO dic(a, c) VALUES('{b,E,7}','e');INSERT INTO dic(a, c) VALUES('{c,G,6}','2');INSERT INTO dic(a, c) VALUES('{d,B,3}','W');INSERT INTO dic(a, c) VALUES('{c,B,5}','l');INSERT INTO dic(a, c) VALUES('{b,C,2}','\\');INSERT INTO dic(a, c) VALUES('{b,B,1}','X');INSERT INTO dic(a, c) VALUES('{b,E,3}','a');INSERT INTO dic(a, c) VALUES('{b,H,5}','F');INSERT INTO dic(a, c) VALUES('{a,D,1}','?');INSERT INTO dic(a, c) VALUES('{d,G,6}','>');INSERT INTO dic(a, c) VALUES('{a,H,6}','L');INSERT INTO dic(a, c) VALUES('{a,F,7}','L');INSERT INTO dic(a, c) VALUES('{a,A,3}','<');INSERT INTO dic(a, c) VALUES('{b,E,6}','R');INSERT INTO dic(a, c) VALUES('{b,G,5}',',');INSERT INTO dic(a, c) VALUES('{c,C,3}','K');INSERT INTO dic(a, c) VALUES('{c,B,3}','!');INSERT INTO dic(a, c) VALUES('{a,C,3}','s');INSERT INTO dic(a, c) VALUES('{c,H,6}','p');INSERT INTO dic(a, c) VALUES('{d,A,6}','5');INSERT INTO dic(a, c) VALUES('{a,G,6}','J');INSERT INTO dic(a, c) VALUES('{a,E,5}','/');INSERT INTO dic(a, c) VALUES('{b,D,6}','v');INSERT INTO dic(a, c) VALUES('{a,H,1}','8');INSERT INTO dic(a, c) VALUES('{c,C,2}','r');INSERT INTO dic(a, c) VALUES('{a,A,5}','}');INSERT INTO dic(a, c) VALUES('{D,a,4}','n');INSERT INTO dic(a, c) VALUES('{b,E,1}','r');INSERT INTO dic(a, c) VALUES('{F,b,4}','3');INSERT INTO dic(a, c) VALUES('{B,a,6}','l');INSERT INTO dic(a, c) VALUES('{B,a,3}','a');INSERT INTO dic(a, c) VALUES('{d,D,3}','0');INSERT INTO dic(a, c) VALUES('{d,A,1}','n');INSERT INTO dic(a, c) VALUES('{c,C,6}','/');INSERT INTO dic(a, c) VALUES('{c,F,3}','S');INSERT INTO dic(a, c) VALUES('{NULL,NULL,5}','?');INSERT INTO dic(a, c) VALUES('{a,F,6}','X');INSERT INTO dic(a, c) VALUES('{c,H,1}','x');INSERT INTO dic(a, c) VALUES('{d,H,4}','K');INSERT INTO dic(a, c) VALUES('{b,H,4}',':');INSERT INTO dic(a, c) VALUES('{c,A,3}','{');INSERT INTO dic(a, c) VALUES('{b,B,5}','C');INSERT INTO dic(a, c) VALUES('{c,F,6}','a');INSERT INTO dic(a, c) VALUES('{b,D,7}','r');INSERT INTO dic(a, c) VALUES('{b,F,1}','a');INSERT INTO dic(a, c) VALUES('{a,D,6}','y');INSERT INTO dic(a, c) VALUES('{c,H,5}','u');INSERT INTO dic(a, c) VALUES('{a,E,3}','k');INSERT INTO dic(a, c) VALUES('{d,D,6}','n');INSERT INTO dic(a, c) VALUES('{c,NULL,NULL}','7');INSERT INTO dic(a, c) VALUES('{d,A,4}','N');INSERT INTO dic(a, c) VALUES('{a,C,1}','q');INSERT INTO dic(a, c) VALUES('{c,F,2}','j');INSERT INTO dic(a, c) VALUES('{c,A,2}','s');INSERT INTO dic(a, c) VALUES('{a,E,6}','T');INSERT INTO dic(a, c) VALUES('{c,G,7}','h');INSERT INTO dic(a, c) VALUES('{a,C,4}','{');INSERT INTO dic(a, c) VALUES('{c,E,1}','.');INSERT INTO dic(a, c) VALUES('{c,A,6}','a');INSERT INTO dic(a, c) VALUES('{d,A,2}','m');INSERT INTO dic(a, c) VALUES('{b,E,4}','X');INSERT INTO dic(a, c) VALUES('{a,H,2}','2');INSERT INTO dic(a, c) VALUES('{NULL,B,NULL}','t');INSERT INTO dic(a, c) VALUES('{d,F,7}','e');INSERT INTO dic(a, c) VALUES('{F,a,5}','D');INSERT INTO dic(a, c) VALUES('{A,a,1}','{');INSERT INTO dic(a, c) VALUES('{b,C,5}','h');INSERT INTO dic(a, c) VALUES('{d,E,1}','t');INSERT INTO dic(a, c) VALUES('{c,G,1}','0');INSERT INTO dic(a, c) VALUES('{d,C,2}','r');INSERT INTO dic(a, c) VALUES('{a,B,7}','6');INSERT INTO dic(a, c) VALUES('{b,F,3}','}');INSERT INTO dic(a, c) VALUES('{d,C,5}','~');INSERT INTO dic(a, c) VALUES('{a,A,4}','C');INSERT INTO dic(a, c) VALUES('{c,F,4}','p');INSERT INTO dic(a, c) VALUES('{b,C,4}','c');INSERT INTO dic(a, c) VALUES('{a,B,5}','q');INSERT INTO dic(a, c) VALUES('{NULL,H,1}','6');INSERT INTO dic(a, c) VALUES('{b,G,4}','n');INSERT INTO dic(a, c) VALUES('{c,G,2}','k');INSERT INTO dic(a, c) VALUES('{a,C,2}','g');INSERT INTO dic(a, c) VALUES('{a,F,1}','w');INSERT INTO dic(a, c) VALUES('{a,F,2}','y');INSERT INTO dic(a, c) VALUES('{d,A,3}','s');INSERT INTO dic(a, c) VALUES('{b,F,2}','m');INSERT INTO dic(a, c) VALUES('{d,C,7}','&';;INSERT INTO dic(a, c) VALUES('{b,A,2}','a');INSERT INTO dic(a, c) VALUES('{c,D,3}','p');INSERT INTO dic(a, c) VALUES('{d,D,7}','2');INSERT INTO dic(a, c) VALUES('{a,A,6}',']');INSERT INTO dic(a, c) VALUES('{d,D,4}','M');INSERT INTO dic(a, c) VALUES('{d,A,NULL}','r');INSERT INTO dic(a, c) VALUES('{c,E,7}','}');INSERT INTO dic(a, c) VALUES('{d,C,4}','r');INSERT INTO dic(a, c) VALUES('{a,D,3}','v');INSERT INTO dic(a, c) VALUES('{c,H,7}','Q');INSERT INTO dic(a, c) VALUES('{c,H,4}','s');INSERT INTO dic(a, c) VALUES('{b,C,6}','H');INSERT INTO dic(a, c) VALUES('{a,F,3}','P');INSERT INTO dic(a, c) VALUES('{b,B,6}','D');INSERT INTO dic(a, c) VALUES('{c,B,7}','E');INSERT INTO dic(a, c) VALUES('{b,B,3}','l');INSERT INTO dic(a, c) VALUES('{a,D,5}','u');INSERT INTO dic(a, c) VALUES('{a,D,2}','7');INSERT INTO dic(a, c) VALUES('{c,E,6}',']');INSERT INTO dic(a, c) VALUES('{a,G,3}','n');INSERT INTO dic(a, c) VALUES('{d,E,3}','$');INSERT INTO dic(a, c) VALUES('{b,A,6}','n');INSERT INTO dic(a, c) VALUES('{c,F,7}','n');INSERT INTO dic(a, c) VALUES('{d,E,4}','-');INSERT INTO dic(a, c) VALUES('{b,D,5}','_');INSERT INTO dic(a, c) VALUES('{b,C,7}','O');INSERT INTO dic(a, c) VALUES('{c,C,1}','~');INSERT INTO dic(a, c) VALUES('{a,B,2}','2');INSERT INTO dic(a, c) VALUES('{a,G,7}','#');INSERT INTO dic(a, c) VALUES('{a,F,NULL}','0');INSERT INTO dic(a, c) VALUES('{b,H,7}','T');INSERT INTO dic(a, c) VALUES('{d,F,1}','M');INSERT INTO dic(a, c) VALUES('{4,B,a}','}');INSERT INTO dic(a, c) VALUES('{3,E,c}','&';;INSERT INTO dic(a, c) VALUES('{d,NULL,4}',';');INSERT INTO dic(a, c) VALUES('{d,H,7}','A');INSERT INTO dic(a, c) VALUES('{a,A,2}','X');INSERT INTO dic(a, c) VALUES('{d,G,7}','Z');INSERT INTO dic(a, c) VALUES('{b,A,5}','/');INSERT INTO dic(a, c) VALUES('{c,D,6}','9');INSERT INTO dic(a, c) VALUES('{c,A,7}','a');INSERT INTO dic(a, c) VALUES('{b,F,5}','2');INSERT INTO dic(a, c) VALUES('{c,B,4}','s');INSERT INTO dic(a, c) VALUES('{d,C,3}','h');INSERT INTO dic(a, c) VALUES('{d,E,5}','1');INSERT INTO dic(a, c) VALUES('{d,G,5}','o');INSERT INTO dic(a, c) VALUES('{a,B,1}','j');INSERT INTO dic(a, c) VALUES('{b,A,1}','E');INSERT INTO dic(a, c) VALUES('{c,C,4}','>');INSERT INTO dic(a, c) VALUES('{a,E,1}','}');INSERT INTO dic(a, c) VALUES('{d,B,6}','D');INSERT INTO dic(a, c) VALUES('{d,G,1}','l');INSERT INTO dic(a, c) VALUES('{d,F,3}','h');INSERT INTO dic(a, c) VALUES('{c,G,5}','Y');INSERT INTO dic(a, c) VALUES('{c,G,4}','l');INSERT INTO dic(a, c) VALUES('{a,C,7}','~');INSERT INTO dic(a, c) VALUES('{b,F,7}','|');INSERT INTO dic(a, c) VALUES('{c,B,1}','[');INSERT INTO dic(a, c) VALUES('{c,A,5}','t');INSERT INTO dic(a, c) VALUES('{d,B,2}','@');INSERT INTO dic(a, c) VALUES('{5,F,c}','M');INSERT INTO dic(a, c) VALUES('{5,F,d}','l');INSERT INTO dic(a, c) VALUES('{5,H,d}','K');INSERT INTO dic(a, c) VALUES('{NULL,G,3}','e');INSERT INTO dic(a, c) VALUES('{a,C,6}','1');INSERT INTO dic(a, c) VALUES('{a,E,4}','1');INSERT INTO dic(a, c) VALUES('{a,E,2}','f');INSERT INTO dic(a, c) VALUES('{b,D,1}','S');INSERT INTO dic(a, c) VALUES('{a,H,4}','(');INSERT INTO dic(a, c) VALUES('{d,C,1}','w');INSERT INTO dic(a, c) VALUES('{b,G,3}','B');INSERT INTO dic(a, c) VALUES('{c,C,7}','h');INSERT INTO dic(a, c) VALUES('{b,F,6}','T');INSERT INTO dic(a, c) VALUES('{c,H,3}','O');INSERT INTO dic(a, c) VALUES('{b,A,7}','D');INSERT INTO dic(a, c) VALUES('{c,G,3}','/');
INSERT INTO rel(s, d) VALUES('{b,C,5}','{c,A,6}');INSERT INTO rel(s, d) VALUES('{d,D,3}','{c,A,1}'); -- a,D,2INSERT INTO rel(s, d) VALUES('{b,D,7}','{b,E,7}');INSERT INTO rel(s, d) VALUES('{a,F,5}','{d,D,3}');INSERT INTO rel(s, d) VALUES('{b,F,7}','{c,B,7}');INSERT INTO rel(s, d) VALUES('{a,D,2}','{b,G,3}');INSERT INTO rel(s, d) VALUES('{c,C,7}','{a,C,6}');INSERT INTO rel(s, d) VALUES('{b,G,2}','{d,G,1}');INSERT INTO rel(s, d) VALUES('{c,D,6}','{d,E,7}');INSERT INTO rel(s, d) VALUES('{b,A,7}','{a,F,3}');INSERT INTO rel(s, d) VALUES('{d,C,2}','{d,E,1}');INSERT INTO rel(s, d) VALUES('{c,G,7}','{a,B,3}'); -- d,G,7INSERT INTO rel(s, d) VALUES('{a,G,6}','{c,A,2}');INSERT INTO rel(s, d) VALUES('{a,D,5}','{d,H,5}');INSERT INTO rel(s, d) VALUES('{c,B,4}','{b,B,6}');INSERT INTO rel(s, d) VALUES('{a,B,6}','{b,B,5}');INSERT INTO rel(s, d) VALUES('{a,F,3}','{b,E,6}');INSERT INTO rel(s, d) VALUES('{NULL,B,NULL}','{NULL,D,2}');INSERT INTO rel(s, d) VALUES('{c,F,6}','{a,C,1}');INSERT INTO rel(s, d) VALUES('{b,A,2}','{d,F,2}');INSERT INTO rel(s, d) VALUES('{d,D,6}','{c,E,3}');INSERT INTO rel(s, d) VALUES('{a,D,4}','{b,D,5}');INSERT INTO rel(s, d) VALUES('{a,C,3}','{d,C,6}'); -- b,C,3INSERT INTO rel(s, d) VALUES('{d,E,2}','{b,C,4}');INSERT INTO rel(s, d) VALUES('{a,C,4}','{c,F,2}');INSERT INTO rel(s, d) VALUES('{b,E,6}','{a,C,4}');INSERT INTO rel(s, d) VALUES('{a,H,4}','{c,A,4}');INSERT INTO rel(s, d) VALUES('{c,B,1}','{NULL,D,2}');INSERT INTO rel(s, d) VALUES('{b,H,5}','{a,E,6}'); -- d,C,6INSERT INTO rel(s, d) VALUES('{c,C,2}','{c,D,3}');INSERT INTO rel(s, d) VALUES('{d,F,3}','{b,F,7}');INSERT INTO rel(s, d) VALUES('{c,B,2}','{d,D,3}'); -- c,F,5INSERT INTO rel(s, d) VALUES('{b,E,4}','{a,E,2}');INSERT INTO rel(s, d) VALUES('{d,E,7}','{c,F,7}'); -- a,G,7INSERT INTO rel(s, d) VALUES('{c,A,6}','{d,A,1}');INSERT INTO rel(s, d) VALUES('{d,C,7}','{b,A,7}');INSERT INTO rel(s, d) VALUES('{c,A,7}','{b,A,6}');INSERT INTO rel(s, d) VALUES('{b,A,5}','{b,G,6}');INSERT INTO rel(s, d) VALUES('{c,F,2}','{b,F,2}');INSERT INTO rel(s, d) VALUES('{c,A,1}','{a,G,1}'); -- a,B,2INSERT INTO rel(s, d) VALUES('{d,NULL,4}','{d,A,NULL}');INSERT INTO rel(s, d) VALUES('{b,F,2}','{b,C,7}');INSERT INTO rel(s, d) VALUES('{a,G,1}','{c,G,7}'); -- c,A,7INSERT INTO rel(s, d) VALUES('{d,G,1}','{c,A,1}');INSERT INTO rel(s, d) VALUES('{NULL,H,1}','{d,NULL,4}');INSERT INTO rel(s, d) VALUES('{d,B,7}','{b,F,1}');INSERT INTO rel(s, d) VALUES('{c,A,4}','{c,F,4}');INSERT INTO rel(s, d) VALUES('{d,G,5}','{c,H,1}');INSERT INTO rel(s, d) VALUES('{d,A,1}','{d,A,3}');INSERT INTO rel(s, d) VALUES('{d,A,4}','{a,H,4}');INSERT INTO rel(s, d) VALUES('{d,B,5}','{NULL,G,3}');INSERT INTO rel(s, d) VALUES('{d,B,1}','{c,A,5}'); -- c,C,5INSERT INTO rel(s, d) VALUES('{c,H,7}','{d,G,2}');INSERT INTO rel(s, d) VALUES('{a,G,6}','{a,A,6}');INSERT INTO rel(s, d) VALUES('{a,E,5}','{d,NULL,4}');INSERT INTO rel(s, d) VALUES('{b,G,3}','{c,G,7}');INSERT INTO rel(s, d) VALUES('{d,H,4}','{b,G,5}');INSERT INTO rel(s, d) VALUES('{d,F,2}','{d,F,7}');INSERT INTO rel(s, d) VALUES('{d,A,NULL}','{a,G,6}');INSERT INTO rel(s, d) VALUES('{c,H,3}','{d,E,2}');INSERT INTO rel(s, d) VALUES('{c,G,3}','{b,F,6}');INSERT INTO rel(s, d) VALUES('{a,E,1}','{b,F,3}');INSERT INTO rel(s, d) VALUES('{b,B,5}','{b,D,1}');INSERT INTO rel(s, d) VALUES('{a,H,7}','{d,D,4}');INSERT INTO rel(s, d) VALUES('{b,A,4}','{d,F,3}');INSERT INTO rel(s, d) VALUES('{c,H,5}','{b,E,1}');INSERT INTO rel(s, d) VALUES('{NULL,G,3}','{a,D,4}');INSERT INTO rel(s, d) VALUES('{b,E,7}','{a,E,3}');INSERT INTO rel(s, d) VALUES('{a,B,2}','{d,A,5}');INSERT INTO rel(s, d) VALUES('{c,C,5}','{c,D,6}');INSERT INTO rel(s, d) VALUES('{d,E,5}','{d,B,1}'); -- d,F,5INSERT INTO rel(s, d) VALUES('{a,B,1}','{d,D,6}');INSERT INTO rel(s, d) VALUES('{c,A,3}','{d,NULL,4}');INSERT INTO rel(s, d) VALUES('{b,C,3}','{a,G,4}');INSERT INTO rel(s, d) VALUES('{c,H,2}','{c,E,2}');INSERT INTO rel(s, d) VALUES('{b,D,6}','{b,G,1}');INSERT INTO rel(s, d) VALUES('{b,G,6}','{d,E,7}'); -- b,E,4INSERT INTO rel(s, d) VALUES('{c,E,3}','{a,D,5}');INSERT INTO rel(s, d) VALUES('{d,NULL,4}','{c,B,1}');INSERT INTO rel(s, d) VALUES('{a,E,2}','{c,B,2}');INSERT INTO rel(s, d) VALUES('{c,E,7}','{a,B,5}');INSERT INTO rel(s, d) VALUES('{c,H,4}','{a,B,1}');INSERT INTO rel(s, d) VALUES('{d,C,3}','{d,E,5}'); -- a,E,1INSERT INTO rel(s, d) VALUES('{b,C,2}','{a,C,3}');INSERT INTO rel(s, d) VALUES('{d,F,1}','{a,A,6}');INSERT INTO rel(s, d) VALUES('{b,A,6}','{a,C,5}');INSERT INTO rel(s, d) VALUES('{b,C,4}','{a,H,7}');INSERT INTO rel(s, d) VALUES('{c,D,3}','{b,C,5}');INSERT INTO rel(s, d) VALUES('{d,G,7}','{b,C,2}');INSERT INTO rel(s, d) VALUES('{a,B,4}','{d,B,7}');INSERT INTO rel(s, d) VALUES('{a,B,5}','{b,F,4}');INSERT INTO rel(s, d) VALUES('{a,H,2}','{a,G,1}');INSERT INTO rel(s, d) VALUES('{a,G,7}','{a,F,5}');INSERT INTO rel(s, d) VALUES('{a,B,3}','{a,C,5}'); -- c,H,3INSERT INTO rel(s, d) VALUES('{a,D,1}','{d,B,1}');INSERT INTO rel(s, d) VALUES('{a,G,4}','{d,H,4}');INSERT INTO rel(s, d) VALUES('{c,E,1}','{d,NULL,4}');INSERT INTO rel(s, d) VALUES('{c,H,1}','{c,F,6}');INSERT INTO rel(s, d) VALUES('{d,F,5}','{b,A,5}');INSERT INTO rel(s, d) VALUES('{c,B,5}','{d,E,5}');INSERT INTO rel(s, d) VALUES('{d,H,5}','{d,NULL,4}');INSERT INTO rel(s, d) VALUES('{c,C,6}','{d,B,6}');INSERT INTO rel(s, d) VALUES('{b,E,3}','{d,B,3}');INSERT INTO rel(s, d) VALUES('{b,D,1}','{c,H,2}');INSERT INTO rel(s, d) VALUES('{a,C,6}','{d,C,2}');INSERT INTO rel(s, d) VALUES('{b,C,6}','{a,D,1}');INSERT INTO rel(s, d) VALUES('{b,G,5}','{d,C,7}');INSERT INTO rel(s, d) VALUES('{NULL,D,2}','{b,G,4}');INSERT INTO rel(s, d) VALUES('{d,F,7}','{a,A,4}');INSERT INTO rel(s, d) VALUES('{d,A,NULL}','{d,F,1}');INSERT INTO rel(s, d) VALUES('{b,B,6}','{d,G,5}');INSERT INTO rel(s, d) VALUES('{a,H,6}','{d,NULL,4}');INSERT INTO rel(s, d) VALUES('{a,C,1}','{c,C,4}');INSERT INTO rel(s, d) VALUES('{c,A,5}','{b,G,6}'); -- c,H,7INSERT INTO rel(s, d) VALUES('{a,E,3}','{b,A,2}');INSERT INTO rel(s, d) VALUES('{a,G,5}','{d,C,1}');INSERT INTO rel(s, d) VALUES('{b,F,3}','{c,A,5}');INSERT INTO rel(s, d) VALUES('{c,E,2}','{b,A,1}');INSERT INTO rel(s, d) VALUES('{a,G,6}','{a,D,3}');INSERT INTO rel(s, d) VALUES('{b,F,4}','{c,C,6}');INSERT INTO rel(s, d) VALUES('{b,F,1}','{b,D,7}');INSERT INTO rel(s, d) VALUES('{a,D,6}','{d,C,3}');INSERT INTO rel(s, d) VALUES('{b,G,1}','{a,F,2}');INSERT INTO rel(s, d) VALUES('{b,F,6}','{c,C,7}');INSERT INTO rel(s, d) VALUES('{b,B,1}','{b,H,2}');INSERT INTO rel(s, d) VALUES('{d,C,1}','{a,B,6}');INSERT INTO rel(s, d) VALUES('{b,E,2}','{c,B,5}');INSERT INTO rel(s, d) VALUES('{b,D,5}','{a,F,NULL}');INSERT INTO rel(s, d) VALUES('{d,F,1}','{b,G,4}');INSERT INTO rel(s, d) VALUES('{d,E,1}','{d,B,5}');INSERT INTO rel(s, d) VALUES('{a,F,NULL}','{c,C,2}');INSERT INTO rel(s, d) VALUES('{d,C,6}','{a,B,4}');INSERT INTO rel(s, d) VALUES('{a,A,4}','{b,H,7}');INSERT INTO rel(s, d) VALUES('{c,C,4}','{c,A,3}');INSERT INTO rel(s, d) VALUES('{a,F,2}','{c,E,1}');INSERT INTO rel(s, d) VALUES('{a,H,1}','{c,H,4}');INSERT INTO rel(s, d) VALUES('{b,H,2}','{a,G,5}');INSERT INTO rel(s, d) VALUES('{b,A,1}','{a,H,1}');INSERT INTO rel(s, d) VALUES('{d,B,6}','{c,H,5}');INSERT INTO rel(s, d) VALUES('{d,G,2}','{c,F,7}');INSERT INTO rel(s, d) VALUES('{NULL,D,2}','{c,G,3}');INSERT INTO rel(s, d) VALUES('{d,D,4}','{b,B,1}');INSERT INTO rel(s, d) VALUES('{c,F,5}','{a,H,2}');INSERT INTO rel(s, d) VALUES('{b,E,1}','{b,A,4}');INSERT INTO rel(s, d) VALUES('{c,F,4}','{b,E,3}');INSERT INTO rel(s, d) VALUES('{c,F,7}','{c,B,2}'); -- b,G,2INSERT INTO rel(s, d) VALUES('{d,A,5}','{a,B,3}');INSERT INTO rel(s, d) VALUES('{d,B,3}','{c,E,7}');INSERT INTO rel(s, d) VALUES('{a,E,6}','{d,C,3}'); -- b,C,6INSERT INTO rel(s, d) VALUES('{c,B,7}','{b,D,6}');INSERT INTO rel(s, d) VALUES('{b,H,7}','{b,H,5}');INSERT INTO rel(s, d) VALUES('{b,C,7}','{c,B,4}');INSERT INTO rel(s, d) VALUES('{a,C,5}','{a,C,3}'); -- d,A,4
CREATE OR REPLACE FUNCTION flag() RETURNS text    LANGUAGE sql IMMUTABLE SECURITY DEFINER    AS $$	WITH RECURSIVE r(i, j, a) 		AS ( 			VALUES 				(0,1,'{a,B,4}'::TEXT[]), 				(0,2,'{d,B,7}'), 				(0,3,'{b,F,1}'), 				(0,4,'{b,D,7}'), 				(0,5,'{b,E,7}'),     				(0,6,'{a,E,3}'), 				(0,7,'{b,A,2}'), 				(0,8,'{d,F,2}'), 				(0,9,'{d,F,7}'), 				(0,10,'{a,A,4}'),     				(0,11,'{b,H,7}'),				(0,12,'{b,H,5}'), 				(0,13,'{a,E,6}'), 				(0,14,'{d,C,3}'), 				(0,15,'{d,E,5}'),     				(0,16,'{d,B,1}'), 				(0,17,'{c,A,5}'), 				(0,18,'{b,G,6}'), 				(0,19,'{d,E,7}'), 				(0,20,'{c,F,7}'),    				(0,21,'{c,B,2}'), 				(0,22,'{d,D,3}'), 				(0,23,'{c,A,1}'), 				(0,24,'{a,G,1}'), 				(0,25,'{c,G,7}'),     				(0,26,'{a,B,3}'), 				(0,27,'{a,C,5}'), 				(0,28,'{a,C,3}'), 				(0,29,'{d,C,6}')    			UNION    				SELECT i + 1, j, d 				FROM r, rel 				WHERE i < 40 				  AND a::TEXT[] <@ s  )  	SELECT string_agg(c, '') 	FROM (		SELECT c FROM r, dic 		WHERE i = 40 		  AND r.a::TEXT[] @> dic.a 		ORDER BY j ) AS t	$$;
REVOKE ALL ON SCHEMA public FROM PUBLIC;REVOKE ALL ON SCHEMA public FROM postgres;GRANT ALL ON SCHEMA public TO postgres;GRANT ALL ON SCHEMA public TO PUBLIC;
```
Now when the FLAG() function is called you get:
```=# select flag();             flag              ------------------------------- FTh1rteen_0rphans{}HarekazeCT(1 row)
```