DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;

CREATE TABLE t1 (
    c1 int
);

CREATE TABLE t2 (
    c1 int,
    c2 int,
    c3 int
);

CREATE TABLE t3 (
    c1 int,
    c2 int
);

CREATE TABLE t4 (
    c1 int,
    c2 int
);

CREATE TABLE t5 (
    c1 int
);

SELECT
    *
FROM
    t1
WHERE
    NOT (
        EXISTS (
            SELECT
               	1
            FROM (
                    SELECT
                        t2.c2 AS c1
                    FROM
                        t2 
                    	LEFT OUTER JOIN t3 ON (t2.c3 = t3.c1 )
                    	LEFT OUTER JOIN (
                        	SELECT
                        	    t5.c1 AS c1
                        	FROM
                        	    t4
                        	LEFT OUTER JOIN t5 ON ( t4.c2 = t5.c1 )
						)
                    	a1 ON ( a1.c1 = t3.c2  )
				) a2
            WHERE
                t1.c1 = a2.c1 
		)
	);
