SET NAMES utf8mb4;
DROP TEMPORARY TABLE IF EXISTS tmp_crefaz_cities;
CREATE TEMPORARY TABLE tmp_crefaz_cities (
  state VARCHAR(2) NOT NULL,
  city VARCHAR(120) NOT NULL,
  PRIMARY KEY (state, city)
) ENGINE=Memory DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO tmp_crefaz_cities (state, city) VALUES
('CE','ABAIARA'),
('BA','ABAIRA'),
('BA','ABARE'),
('PE','ABREU E LIMA'),
('BA','ACAJUTIBA'),
('CE','ACARAPE'),
('CE','ACARAU'),
('RN','ACARI'),
('CE','ACOPIARA'),
('RN','ACU'),
('BA','ADUSTINA'),
('PE','AFOGADOS DA INGAZEIRA'),
('RN','AFONSO BEZERRA'),
('PE','AFRANIO'),
('PE','AGRESTINA'),
('BA','AGUA FRIA'),
('RN','AGUA NOVA'),
('PE','AGUA PRETA'),
('PE','AGUAS BELAS'),
('SP','AGUAS DE LINDOIA'),
('SP','AGUAS DE SANTA BARBARA'),
('SP','AGUAS DE SAO PEDRO'),
('RS','AGUDO'),
('SP','AGUDOS'),
('BA','AIQUARA'),
('CE','AIUABA'),
('PE','ALAGOINHA'),
('BA','ALAGOINHAS'),
('SP','ALAMBARI'),
('CE','ALCANTARAS'),
('BA','ALCOBACA'),
('RS','ALEGRETE'),
('RS','ALEGRIA'),
('RN','ALEXANDRIA'),
('PE','ALIANCA'),
('BA','ALMADINA'),
('RN','ALMINO AFONSO'),
('SP','ALTAIR'),
('CE','ALTANEIRA'),
('PE','ALTINHO'),
('SP','ALTINOPOLIS'),
('SP','ALTO ALEGRE'),
('RN','ALTO DO RODRIGUES'),
('RS','ALTO FELIZ'),
('CE','ALTO SANTO'),
('SP','ALUMINIO'),
('SP','ALVARO DE CARVALHO'),
('SP','ALVINLANDIA'),
('PE','AMARAJI'),
('BA','AMARGOSA'),
('BA','AMELIA RODRIGUES'),
('BA','AMERICA DOURADA'),
('SP','AMERICANA'),
('SP','AMERICO BRASILIENSE'),
('CE','AMONTADA'),
('SP','AMPARO'),
('BA','ANAGE'),
('SP','ANALANDIA'),
('BA','ANDARAI'),
('BA','ANDORINHA'),
('RS','ANDRE DA ROCHA'),
('PE','ANGELIM'),
('BA','ANGICAL'),
('RN','ANGICOS'),
('RJ','ANGRA DOS REIS'),
('BA','ANGUERA'),
('RS','ANTA GORDA'),
('BA','ANTAS'),
('CE','ANTONINA DO NORTE'),
('BA','ANTONIO CARDOSO'),
('BA','ANTONIO GONCALVES'),
('RN','ANTONIO MARTINS'),
('RS','ANTONIO PRADO'),
('RJ','APERIBE'),
('RN','APODI'),
('BA','APORA'),
('BA','APUAREMA'),
('CE','APUIARES'),
('CE','AQUIRAZ'),
('SP','ARACARIGUAMA'),
('BA','ARACAS'),
('CE','ARACATI'),
('BA','ARACATU'),
('SP','ARACATUBA'),
('BA','ARACI'),
('PE','ARACOIABA'),
('CE','ARACOIABA'),
('SP','ARACOIABA DA SERRA'),
('BA','ARAMARI'),
('SP','ARAMINA'),
('SP','ARANDU'),
('SP','ARARAQUARA'),
('CE','ARARENDA'),
('RS','ARARICA'),
('CE','ARARIPE'),
('PE','ARARIPINA'),
('BA','ARATACA'),
('RS','ARATIBA'),
('CE','ARATUBA'),
('BA','ARATUIPE'),
('MG','ARCEBURGO'),
('PE','ARCOVERDE'),
('RJ','AREAL'),
('SP','AREALVA'),
('RN','AREIA BRANCA'),
('SP','AREIOPOLIS'),
('RN','ARES'),
('SP','ARIRANHA'),
('RJ','ARMACAO DOS BUZIOS'),
('CE','ARNEIROZ'),
('RJ','ARRAIAL DO CABO'),
('RS','ARROIO DO MEIO'),
('RS','ARROIO DO TIGRE'),
('RS','ARVOREZINHA'),
('CE','ASSARE'),
('RN','AUGUSTO SEVERO'),
('RS','AUREA'),
('BA','AURELINO LEAL'),
('CE','AURORA'),
('SP','AVAI'),
('SP','AVANHANDAVA'),
('SP','AVARE'),
('SP','BADY BASSITT'),
('RN','BAIA FORMOSA'),
('BA','BAIANOPOLIS'),
('BA','BAIXA GRANDE'),
('CE','BAIXIO'),
('SP','BALBINOS'),
('SP','BALSAMO'),
('CE','BANABUIU'),
('BA','BANZAE'),
('RS','BARAO DE COTEGIPE'),
('RN','BARAUNA'),
('CE','BARBALHA'),
('SP','BARBOSA'),
('RN','BARCELONA'),
('SP','BARIRI'),
('BA','BARRA'),
('SP','BARRA BONITA'),
('BA','BARRA DA ESTIVA'),
('PE','BARRA DE GUABIRABA'),
('BA','BARRA DO CHOCA'),
('BA','BARRA DO MENDES'),
('RS','BARRA DO QUARAI'),
('BA','BARRA DO ROCHA'),
('RS','BARRA FUNDA'),
('RS','BARRACAO'),
('CE','BARREIRA'),
('BA','BARREIRAS'),
('PE','BARREIROS'),
('SP','BARRETOS'),
('SP','BARRINHA'),
('CE','BARRO'),
('BA','BARRO ALTO'),
('BA','BARROCAS'),
('CE','BARROQUINHA'),
('RS','BARROS CASSAL'),
('SP','BATATAIS'),
('CE','BATURITE'),
('SP','BAURU'),
('SP','BEBEDOURO'),
('CE','BEBERIBE'),
('CE','BELA CRUZ'),
('PE','BELEM DE MARIA'),
('PE','BELEM DO SAO FRANCISCO'),
('BA','BELMONTE'),
('BA','BELO CAMPO'),
('PE','BELO JARDIM'),
('SP','BENTO DE ABREU'),
('RN','BENTO FERNANDES'),
('RS','BENTO GONCALVES'),
('SP','BERNARDINO DE CAMPOS'),
('PE','BETANIA'),
('PE','BEZERROS'),
('SP','BILAC'),
('SP','BIRIGUI'),
('BA','BIRITINGA'),
('SP','BOA ESPERANCA DO SUL'),
('BA','BOA NOVA'),
('CE','BOA VIAGEM'),
('RS','BOA VISTA DO BURICA'),
('BA','BOA VISTA DO TUPIM'),
('SP','BOCAINA'),
('RN','BODO'),
('PE','BODOCO'),
('SP','BOFETE'),
('SP','BOITUVA'),
('PE','BOM CONSELHO'),
('RJ','BOM JARDIM'),
('PE','BOM JARDIM'),
('RN','BOM JESUS'),
('RS','BOM JESUS'),
('BA','BOM JESUS DA LAPA'),
('BA','BOM JESUS DA SERRA'),
('RJ','BOM JESUS DO ITABAPOANA'),
('RS','BOM PRINCIPIO'),
('RS','BOM PROGRESSO'),
('BA','BONINAL'),
('BA','BONITO'),
('PE','BONITO'),
('BA','BOQUIRA'),
('SP','BORACEIA'),
('SP','BOREBI'),
('SP','BOTUCATU'),
('BA','BOTUPORA'),
('RS','BRAGA'),
('SP','BRAUNA'),
('PE','BREJAO'),
('PE','BREJINHO'),
('RN','BREJINHO'),
('SP','BREJO ALEGRE'),
('PE','BREJO DA MADRE DE DEUS'),
('CE','BREJO SANTO'),
('BA','BREJOES'),
('BA','BREJOLANDIA'),
('RS','BROCHIER'),
('SP','BRODOWSKI'),
('SP','BROTAS'),
('BA','BROTAS DE MACAUBAS'),
('BA','BRUMADO'),
('PE','BUENOS AIRES'),
('BA','BUERAREMA'),
('PE','BUIQUE'),
('BA','BURITIRAMA'),
('SP','BURITIZAL'),
('BA','CAATIBA'),
('BA','CABACEIRAS DO PARAGUACU'),
('PE','CABO DE SANTO AGOSTINHO'),
('RJ','CABO FRIO'),
('SP','CABRALIA PAULISTA'),
('PE','CABROBO'),
('RS','CACAPAVA DO SUL'),
('RS','CACEQUI'),
('BA','CACHOEIRA'),
('PE','CACHOEIRINHA'),
('RS','CACHOEIRINHA'),
('RS','CACIQUE DOBLE'),
('SP','CACONDE'),
('BA','CACULE'),
('BA','CAEM'),
('BA','CAETANOS'),
('PE','CAETES'),
('BA','CAETITE'),
('BA','CAFARNAUM'),
('SP','CAFELANDIA'),
('RS','CAICARA'),
('RN','CAICARA DO NORTE'),
('RN','CAICARA DO RIO DO VENTO'),
('RN','CAICO'),
('BA','CAIRU'),
('SP','CAJOBI'),
('SP','CAJURU'),
('PE','CALCADO'),
('BA','CALDEIRAO GRANDE'),
('PE','CALUMBI'),
('BA','CAMACAN'),
('BA','CAMACARI'),
('BA','CAMAMU'),
('PE','CAMARAGIBE'),
('RS','CAMARGO'),
('RS','CAMBARA DO SUL'),
('RJ','CAMBUCI'),
('CE','CAMOCIM'),
('PE','CAMOCIM DE SAO FELIX'),
('RS','CAMPESTRE DA SERRA'),
('SP','CAMPINAS'),
('BA','CAMPO ALEGRE DE LOURDES'),
('RS','CAMPO BOM'),
('BA','CAMPO FORMOSO'),
('SP','CAMPO LIMPO PAULISTA'),
('RS','CAMPO NOVO'),
('RN','CAMPO REDONDO'),
('RJ','CAMPOS DOS GOYTACAZES'),
('SP','CAMPOS NOVOS PAULISTA'),
('CE','CAMPOS SALES'),
('PE','CAMUTANGA'),
('BA','CANAPOLIS'),
('BA','CANARANA'),
('BA','CANAVIEIRAS'),
('BA','CANDEAL'),
('BA','CANDEIAS'),
('RS','CANDELARIA'),
('BA','CANDIBA'),
('SP','CANDIDO RODRIGUES'),
('BA','CANDIDO SALES'),
('RS','CANELA'),
('RN','CANGUARETAMA'),
('PE','CANHOTINHO'),
('CE','CANINDE'),
('SP','CANITAR'),
('RS','CANOAS'),
('BA','CANSANCAO'),
('RJ','CANTAGALO'),
('BA','CANUDOS'),
('RS','CAPAO BONITO DO SUL'),
('RS','CAPAO DO CIPO'),
('RS','CAPELA DE SANTANA'),
('SP','CAPELA DO ALTO'),
('BA','CAPELA DO ALTO ALEGRE'),
('BA','CAPIM GROSSO'),
('CE','CAPISTRANO'),
('SP','CAPIVARI'),
('PE','CAPOEIRAS'),
('BA','CARAIBAS'),
('RJ','CARAPEBUS'),
('RN','CARAUBAS'),
('BA','CARAVELAS'),
('BA','CARDEAL DA SILVA'),
('RJ','CARDOSO MOREIRA'),
('CE','CARIDADE'),
('BA','CARINHANHA'),
('CE','CARIRE'),
('CE','CARIRIACU'),
('CE','CARIUS'),
('RS','CARLOS BARBOSA'),
('PE','CARNAIBA'),
('RN','CARNAUBA DOS DANTAS'),
('RN','CARNAUBAIS'),
('CE','CARNAUBAL'),
('PE','CARNAUBEIRA DA PENHA'),
('PE','CARPINA'),
('PE','CARUARU'),
('SP','CASA BRANCA'),
('BA','CASA NOVA'),
('RS','CASCA'),
('CE','CASCAVEL'),
('RS','CASEIROS'),
('RJ','CASIMIRO DE ABREU'),
('PE','CASINHAS'),
('SP','CASSIA DOS COQUEIROS'),
('BA','CASTRO ALVES'),
('CE','CATARINA'),
('PE','CATENDE'),
('BA','CATOLANDIA'),
('BA','CATU'),
('CE','CATUNDA'),
('BA','CATURAMA'),
('CE','CAUCAIA'),
('RS','CAXIAS DO SUL'),
('RN','CEARA-MIRIM'),
('SP','CEDRAL'),
('PE','CEDRO'),
('CE','CEDRO'),
('BA','CENTRAL'),
('SP','CERQUEIRA CESAR'),
('RS','CERRO BRANCO'),
('RN','CERRO CORA'),
('RS','CERRO LARGO'),
('PE','CHA DE ALEGRIA'),
('PE','CHA GRANDE'),
('SP','CHARQUEADA'),
('CE','CHAVAL'),
('SP','CHAVANTES'),
('CE','CHORO'),
('CE','CHOROZINHO'),
('BA','CHORROCHO'),
('BA','CICERO DANTAS'),
('BA','CIPO'),
('SP','CLEMENTINA'),
('BA','COARACI'),
('BA','COCOS'),
('SP','COLINA'),
('RS','COLINAS'),
('SP','COLOMBIA'),
('BA','CONCEICAO DA FEIRA'),
('RJ','CONCEICAO DE MACABU'),
('BA','CONCEICAO DO ALMEIDA'),
('BA','CONCEICAO DO COITE'),
('BA','CONCEICAO DO JACUIPE'),
('PE','CONDADO'),
('BA','CONDE'),
('BA','CONDEUBA'),
('RS','CONSTANTINA'),
('BA','CONTENDAS DO SINCORA'),
('BA','CORACAO DE MARIA'),
('RJ','CORDEIRO'),
('BA','CORDEIROS'),
('CE','COREAU'),
('BA','CORIBE'),
('SP','COROADOS'),
('RS','CORONEL BICACO'),
('RN','CORONEL EZEQUIEL'),
('RN','CORONEL JOAO PESSOA'),
('BA','CORONEL JOAO SA'),
('RS','CORONEL PILAR'),
('PE','CORRENTES'),
('BA','CORRENTINA'),
('PE','CORTES'),
('SP','COSMOPOLIS'),
('BA','COTEGIPE'),
('RS','COTIPORA'),
('CE','CRATEUS'),
('CE','CRATO'),
('SP','CRAVINHOS'),
('BA','CRAVOLANDIA'),
('BA','CRISOPOLIS'),
('RS','CRISSIUMAL'),
('SP','CRISTAIS PAULISTA'),
('BA','CRISTOPOLIS'),
('CE','CROATA'),
('CE','CRUZ'),
('BA','CRUZ DAS ALMAS'),
('RS','CRUZEIRO DO SUL'),
('RN','CRUZETA'),
('SP','CUBATAO'),
('PE','CUMARU'),
('PE','CUPIRA'),
('BA','CURACA'),
('RN','CURRAIS NOVOS'),
('PE','CUSTODIA'),
('BA','DARIO MEIRA'),
('CE','DEPUTADO IRAPUAN PINHEIRO'),
('SP','DESCALVADO'),
('RS','DEZESSEIS DE NOVEMBRO'),
('BA','DIAS D AVILA'),
('SP','DIVINOLANDIA'),
('SP','DOBRADA'),
('SP','DOIS CORREGOS'),
('RS','DOIS IRMAOS'),
('RS','DOIS IRMAOS DAS MISSOES'),
('RS','DOIS LAJEADOS'),
('BA','DOM BASILIO'),
('BA','DOM MACEDO COSTA'),
('PE','DORMENTES'),
('SP','DOURADO'),
('RS','DOUTOR MAURICIO CARDOSO'),
('RN','DOUTOR SEVERIANO'),
('SP','DUARTINA'),
('RJ','DUAS BARRAS'),
('SP','DUMONT'),
('SP','ELIAS FAUSTO'),
('BA','ELISIO MEDRADO'),
('SP','EMBAUBA'),
('RS','ENCANTADO'),
('RN','ENCANTO'),
('BA','ENCRUZILHADA'),
('RS','ENGENHO VELHO'),
('BA','ENTRE RIOS'),
('RS','ENTRE RIOS DO SUL'),
('RN','EQUADOR'),
('RS','ERECHIM'),
('CE','ERERE'),
('BA','ERICO CARDOSO'),
('RS','ERVAL GRANDE'),
('RS','ERVAL SECO'),
('PE','ESCADA'),
('RS','ESMERALDA'),
('RN','ESPIRITO SANTO'),
('SP','ESPIRITO SANTO DO PINHAL'),
('SP','ESPIRITO SANTO DO TURVO'),
('BA','ESPLANADA'),
('RS','ESTANCIA VELHA'),
('RS','ESTEIO'),
('RS','ESTRELA'),
('BA','EUCLIDES DA CUNHA'),
('RS','EUGENIO DE CASTRO'),
('BA','EUNAPOLIS'),
('CE','EUSEBIO'),
('RN','EXTREMOZ'),
('PE','EXU'),
('RS','FAGUNDES VARELA'),
('CE','FARIAS BRITO'),
('RS','FARROUPILHA'),
('BA','FATIMA'),
('RS','FAXINALZINHO'),
('BA','FEIRA DA MATA'),
('BA','FEIRA DE SANTANA'),
('PE','FEIRA NOVA'),
('RN','FELIPE GUERRA'),
('RS','FELIZ'),
('PE','FERNANDO DE NORONHA'),
('RN','FERNANDO PEDROZA'),
('SP','FERNANDO PRESTES'),
('SP','FERNAO'),
('PE','FERREIROS'),
('BA','FILADELFIA'),
('BA','FIRMINO ALVES'),
('RN','FLORANIA'),
('PE','FLORES'),
('RS','FLORES DA CUNHA'),
('PE','FLORESTA'),
('BA','FLORESTA AZUL'),
('RS','FORMIGUEIRO'),
('BA','FORMOSA DO RIO PRETO'),
('CE','FORQUILHA'),
('CE','FORTALEZA'),
('CE','FORTIM'),
('SP','FRANCA'),
('RN','FRANCISCO DANTAS'),
('CE','FRECHEIRINHA'),
('RS','FREDERICO WESTPHALEN'),
('PE','FREI MIGUELINHO'),
('RN','FRUTUOSO GOMES'),
('SP','GABRIEL MONTEIRO'),
('SP','GALIA'),
('RN','GALINHOS'),
('PE','GAMELEIRA'),
('BA','GANDU'),
('PE','GARANHUNS'),
('SP','GARCA');

INSERT INTO tmp_crefaz_cities (state, city) VALUES
('RS','GARIBALDI'),
('RS','GAURAMA'),
('BA','GAVIAO'),
('SP','GAVIAO PEIXOTO'),
('CE','GENERAL SAMPAIO'),
('BA','GENTIO DO OURO'),
('SP','GETULINA'),
('SP','GLICERIO'),
('BA','GLORIA'),
('PE','GLORIA DO GOITA'),
('RS','GLORINHA'),
('PE','GOIANA'),
('RN','GOIANINHA'),
('BA','GONGOGI'),
('RN','GOVERNADOR DIX-SEPT ROSADO'),
('BA','GOVERNADOR MANGABEIRA'),
('CE','GRACA'),
('RS','GRAMADO'),
('PE','GRANITO'),
('CE','GRANJA'),
('CE','GRANJEIRO'),
('PE','GRAVATA'),
('RS','GRAVATAI'),
('CE','GROAIRAS'),
('RN','GROSSOS'),
('RS','GUABIJU'),
('SP','GUAICARA'),
('SP','GUAIMBE'),
('SP','GUAIRA'),
('CE','GUAIUBA'),
('BA','GUAJERU'),
('RN','GUAMARE'),
('BA','GUANAMBI'),
('SP','GUAPIACU'),
('RJ','GUAPIMIRIM'),
('RS','GUAPORE'),
('SP','GUARA'),
('SP','GUARACI'),
('CE','GUARACIABA DO NORTE'),
('CE','GUARAMIRANGA'),
('RS','GUARANI DAS MISSOES'),
('SP','GUARANTA'),
('SP','GUARARAPES'),
('BA','GUARATINGA'),
('SP','GUAREI'),
('SP','GUARIBA'),
('SP','GUATAPARA'),
('RS','HARMONIA'),
('BA','HELIOPOLIS'),
('SP','HERCULANDIA'),
('CE','HIDROLANDIA'),
('CE','HORIZONTE'),
('RS','HORIZONTINA'),
('SP','HORTOLANDIA'),
('RS','HUMAITA'),
('SP','IACANGA'),
('BA','IACU'),
('SP','IARAS'),
('PE','IATI'),
('RS','IBARAMA'),
('CE','IBARETAMA'),
('SP','IBATE'),
('CE','IBIAPINA'),
('BA','IBIASSUCE'),
('BA','IBICARAI'),
('BA','IBICOARA'),
('BA','IBICUI'),
('CE','IBICUITINGA'),
('PE','IBIMIRIM'),
('BA','IBIPEBA'),
('BA','IBIPITANGA'),
('BA','IBIQUERA'),
('SP','IBIRA'),
('RS','IBIRAIARAS'),
('PE','IBIRAJUBA'),
('BA','IBIRAPITANGA'),
('BA','IBIRAPUA'),
('BA','IBIRATAIA'),
('BA','IBITIARA'),
('SP','IBITINGA'),
('BA','IBITITA'),
('BA','IBOTIRAMA'),
('CE','ICAPUI'),
('SP','ICEM'),
('BA','ICHU'),
('CE','ICO'),
('RN','IELMO MARINHO'),
('BA','IGAPORA'),
('SP','IGARACU DO TIETE'),
('SP','IGARAPAVA'),
('PE','IGARASSU'),
('BA','IGRAPIUNA'),
('RS','IGREJINHA'),
('RJ','IGUABA GRANDE'),
('BA','IGUAI'),
('PE','IGUARACY'),
('CE','IGUATU'),
('PE','ILHA DE ITAMARACA'),
('BA','ILHEUS'),
('RS','ILOPOLIS'),
('RS','IMIGRANTE'),
('PE','INAJA'),
('SP','INDAIATUBA'),
('CE','INDEPENDENCIA'),
('PE','INGAZEIRA'),
('BA','INHAMBUPE'),
('RN','IPANGUACU'),
('CE','IPAPORANGA'),
('CE','IPAUMIRIM'),
('SP','IPAUSSU'),
('RS','IPE'),
('BA','IPECAETA'),
('SP','IPERO'),
('BA','IPIAU'),
('BA','IPIRA'),
('PE','IPOJUCA'),
('CE','IPU'),
('SP','IPUA'),
('PE','IPUBI'),
('RN','IPUEIRA'),
('CE','IPUEIRAS'),
('BA','IPUPIARA'),
('CE','IRACEMA'),
('RS','IRAI'),
('BA','IRAJUBA'),
('BA','IRAMAIA'),
('BA','IRAQUARA'),
('BA','IRARA'),
('CE','IRAUCUBA'),
('BA','IRECE'),
('RS','ITAARA'),
('BA','ITABELA'),
('BA','ITABERABA'),
('RJ','ITABORAI'),
('BA','ITABUNA'),
('BA','ITACARE'),
('PE','ITACURUBA'),
('RS','ITACURUBI'),
('BA','ITAETE'),
('BA','ITAGI'),
('BA','ITAGIBA'),
('BA','ITAGIMIRIM'),
('BA','ITAGUACU DA BAHIA'),
('PE','ITAIBA'),
('CE','ITAICABA'),
('CE','ITAITINGA'),
('RN','ITAJA'),
('SP','ITAJU'),
('BA','ITAJU DO COLONIA'),
('BA','ITAJUIPE'),
('RJ','ITALVA'),
('BA','ITAMARAJU'),
('BA','ITAMARI'),
('BA','ITAMBE'),
('PE','ITAMBE'),
('MG','ITAMOGI'),
('BA','ITANAGRA'),
('BA','ITANHEM'),
('RJ','ITAOCARA'),
('CE','ITAPAJE'),
('BA','ITAPARICA'),
('BA','ITAPE'),
('BA','ITAPEBI'),
('RJ','ITAPERUNA'),
('PE','ITAPETIM'),
('BA','ITAPETINGA'),
('SP','ITAPETININGA'),
('BA','ITAPICURU'),
('CE','ITAPIPOCA'),
('SP','ITAPIRA'),
('PE','ITAPISSUMA'),
('BA','ITAPITANGA'),
('CE','ITAPIUNA'),
('SP','ITAPOLIS'),
('SP','ITAPUI'),
('BA','ITAQUARA'),
('RS','ITAQUI'),
('PE','ITAQUITINGA'),
('BA','ITARANTIM'),
('CE','ITAREMA'),
('RJ','ITATIAIA'),
('SP','ITATIBA'),
('RS','ITATIBA DO SUL'),
('BA','ITATIM'),
('SP','ITATINGA'),
('CE','ITATIRA'),
('RN','ITAU'),
('SP','ITIRAPUA'),
('BA','ITIRUCU'),
('BA','ITIUBA'),
('SP','ITOBI'),
('BA','ITORORO'),
('SP','ITU'),
('BA','ITUACU'),
('BA','ITUBERA'),
('SP','ITUPEVA'),
('SP','ITUVERAVA'),
('BA','IUIU'),
('RS','IVOTI'),
('PE','JABOATAO DOS GUARARAPES'),
('SP','JABORANDI'),
('BA','JABORANDI'),
('SP','JABOTICABAL'),
('RN','JACANA'),
('BA','JACARACI'),
('PR','JACAREZINHO'),
('SP','JACI'),
('BA','JACOBINA'),
('RS','JACUTINGA'),
('BA','JAGUAQUARA'),
('BA','JAGUARARI'),
('CE','JAGUARETAMA'),
('RS','JAGUARI'),
('CE','JAGUARIBARA'),
('CE','JAGUARIBE'),
('BA','JAGUARIPE'),
('SP','JAGUARIUNA'),
('CE','JAGUARUANA'),
('RN','JANDAIRA'),
('RN','JANDUIS'),
('RN','JANUARIO CICCO'),
('RN','JAPI'),
('PE','JAQUEIRA'),
('RS','JAQUIRANA'),
('CE','JARDIM'),
('RN','JARDIM DE ANGICOS'),
('RN','JARDIM DE PIRANHAS'),
('RN','JARDIM DO SERIDO'),
('SP','JARDINOPOLIS'),
('PE','JATAUBA'),
('CE','JATI'),
('PE','JATOBA'),
('SP','JAU'),
('BA','JEQUIE'),
('BA','JEREMOABO'),
('SP','JERIQUARA'),
('CE','JIJOCA DE JERICOACOARA'),
('BA','JIQUIRICA'),
('BA','JITAUNA'),
('PE','JOAO ALFREDO'),
('RN','JOAO CAMARA'),
('RN','JOAO DIAS'),
('BA','JOAO DOURADO'),
('PE','JOAQUIM NABUCO'),
('SP','JOSE BONIFACIO'),
('RN','JOSE DA PENHA'),
('BA','JUAZEIRO'),
('CE','JUAZEIRO DO NORTE'),
('CE','JUCAS'),
('PE','JUCATI'),
('BA','JUCURUCU'),
('RN','JUCURUTU'),
('RS','JULIO DE CASTILHOS'),
('SP','JULIO MESQUITA'),
('RN','JUNDIA'),
('SP','JUNDIAI'),
('PE','JUPI'),
('PE','JUREMA'),
('BA','JUSSARA'),
('BA','JUSSARI'),
('BA','JUSSIAPE'),
('BA','LAFAIETE COUTINHO'),
('RN','LAGOA DE PEDRAS'),
('RN','LAGOA DE VELHOS'),
('PE','LAGOA DO CARRO'),
('PE','LAGOA DO OURO'),
('PE','LAGOA DOS GATOS'),
('PE','LAGOA GRANDE'),
('RN','LAGOA NOVA'),
('BA','LAGOA REAL'),
('RN','LAGOA SALGADA'),
('RS','LAGOA VERMELHA'),
('RS','LAGOAO'),
('BA','LAJE'),
('RJ','LAJE DO MURIAE'),
('BA','LAJEDAO'),
('BA','LAJEDINHO'),
('PE','LAJEDO'),
('BA','LAJEDO DO TABOCAL'),
('RN','LAJES'),
('RN','LAJES PINTADAS'),
('BA','LAMARAO'),
('BA','LAPAO'),
('BA','LAURO DE FREITAS'),
('CE','LAVRAS DA MANGABEIRA'),
('BA','LENCOIS'),
('SP','LENCOIS PAULISTA'),
('RS','LIBERATO SALZANO'),
('BA','LICINIO DE ALMEIDA'),
('PE','LIMOEIRO'),
('CE','LIMOEIRO DO NORTE'),
('SP','LINDOIA'),
('RS','LINDOLFO COLLOR'),
('RS','LINHA NOVA'),
('SP','LINS'),
('BA','LIVRAMENTO DE NOSSA SENHORA'),
('SP','LOUVEIRA'),
('SP','LUCIANOPOLIS'),
('RN','LUCRECIA'),
('SP','LUIS ANTONIO'),
('BA','LUIS EDUARDO MAGALHAES'),
('RN','LUIS GOMES'),
('SP','LUIZIANIA'),
('SP','LUPERCIO'),
('RJ','MACAE'),
('RN','MACAIBA'),
('BA','MACAJUBA'),
('RS','MACAMBARA'),
('PE','MACAPARANA'),
('BA','MACARANI'),
('SP','MACATUBA'),
('RN','MACAU'),
('BA','MACAUBAS'),
('RS','MACHADINHO'),
('PE','MACHADOS'),
('RJ','MACUCO'),
('BA','MACURURE'),
('CE','MADALENA'),
('BA','MADRE DE DEUS'),
('BA','MAETINGA'),
('RJ','MAGE'),
('BA','MAIQUINIQUE'),
('BA','MAIRI'),
('RN','MAJOR SALES'),
('BA','MALHADA'),
('BA','MALHADA DE PEDRAS'),
('PE','MANARI'),
('SP','MANDURI'),
('RJ','MANGARATIBA'),
('RS','MANOEL VIANA'),
('BA','MANOEL VITORINO'),
('BA','MANSIDAO'),
('CE','MARACANAU'),
('BA','MARACAS'),
('BA','MARAGOGIPE'),
('PE','MARAIAL'),
('CE','MARANGUAPE'),
('BA','MARAU'),
('RS','MARCELINO RAMOS'),
('RN','MARCELINO VIEIRA'),
('BA','MARCIONILIO SOUZA'),
('CE','MARCO'),
('RS','MARIANO MORO'),
('RJ','MARICA'),
('SP','MARILIA'),
('CE','MARTINOPOLE'),
('RN','MARTINS'),
('BA','MASCOTE'),
('CE','MASSAPE'),
('RS','MATA'),
('BA','MATA DE SAO JOAO'),
('SP','MATAO'),
('BA','MATINA'),
('RS','MATO LEITAO'),
('CE','MAURITI'),
('RN','MAXARANGUAPE'),
('RS','MAXIMILIANO DE ALMEIDA'),
('BA','MEDEIROS NETO'),
('CE','MERUOCA'),
('RN','MESSIAS TARGINO'),
('BA','MIGUEL CALMON'),
('SP','MIGUELOPOLIS'),
('BA','MILAGRES'),
('CE','MILAGRES'),
('CE','MILHA'),
('SP','MINEIROS DO TIETE'),
('RJ','MIRACEMA'),
('RS','MIRAGUAI'),
('CE','MIRAIMA'),
('PE','MIRANDIBA'),
('BA','MIRANGABA'),
('BA','MIRANTE'),
('SP','MIRASSOL'),
('SP','MIRASSOLANDIA'),
('CE','MISSAO VELHA'),
('SP','MOCOCA'),
('CE','MOMBACA'),
('SP','MOMBUCA'),
('CE','MONSENHOR TABOSA'),
('RN','MONTANHAS'),
('RS','MONTAURI'),
('RN','MONTE ALEGRE'),
('SP','MONTE ALEGRE DO SUL'),
('RS','MONTE ALEGRE DOS CAMPOS'),
('SP','MONTE ALTO'),
('SP','MONTE APRAZIVEL'),
('SP','MONTE AZUL PAULISTA'),
('RS','MONTE BELO DO SUL'),
('RN','MONTE DAS GAMELEIRAS'),
('SP','MONTE MOR'),
('BA','MONTE SANTO'),
('MG','MONTE SANTO DE MINAS'),
('CE','MORADA NOVA'),
('CE','MORAUJO'),
('PE','MOREILANDIA'),
('PE','MORENO'),
('BA','MORPARA'),
('CE','MORRINHOS'),
('SP','MORRO AGUDO'),
('BA','MORRO DO CHAPEU'),
('RS','MORRO REUTER'),
('BA','MORTUGABA'),
('SP','MORUNGABA'),
('RN','MOSSORO'),
('SP','MOTUCA'),
('CE','MUCAMBO'),
('BA','MUCUGE'),
('RS','MUCUM'),
('BA','MUCURI'),
('CE','MULUNGU'),
('BA','MULUNGU DO MORRO'),
('BA','MUNDO NOVO'),
('BA','MUNIZ FERREIRA'),
('BA','MURITIBA'),
('BA','MUTUIPE'),
('RN','NATAL'),
('RJ','NATIVIDADE'),
('BA','NAZARE'),
('PE','NAZARE DA MATA'),
('SP','NEVES PAULISTA'),
('BA','NILO PECANHA'),
('RN','NISIA FLORESTA'),
('RJ','NITEROI'),
('RS','NONOAI'),
('BA','NORDESTINA'),
('RS','NOVA ALVORADA'),
('RS','NOVA ARACA'),
('RS','NOVA BASSANO'),
('RS','NOVA BOA VISTA'),
('RS','NOVA BRESCIA'),
('BA','NOVA CANAA'),
('RN','NOVA CRUZ'),
('RS','NOVA ESPERANCA DO SUL'),
('SP','NOVA EUROPA'),
('BA','NOVA FATIMA'),
('SP','NOVA GRANADA'),
('RS','NOVA HARTZ'),
('BA','NOVA IBIA'),
('BA','NOVA ITARANA'),
('SP','NOVA ODESSA'),
('CE','NOVA OLINDA'),
('RS','NOVA PADUA'),
('RS','NOVA PETROPOLIS'),
('RS','NOVA PRATA'),
('BA','NOVA REDENCAO'),
('RS','NOVA ROMA DO SUL'),
('CE','NOVA RUSSAS'),
('RS','NOVA SANTA RITA'),
('BA','NOVA SOURE'),
('BA','NOVA VICOSA'),
('RS','NOVO BARREIRO'),
('RS','NOVO HAMBURGO'),
('BA','NOVO HORIZONTE'),
('RS','NOVO MACHADO'),
('CE','NOVO ORIENTE'),
('BA','NOVO TRIUNFO'),
('SP','NUPORANGA'),
('CE','OCARA'),
('SP','OCAUCU'),
('SP','OLEO'),
('RN','OLHO D AGUA DO BORGES'),
('SP','OLIMPIA'),
('PE','OLINDA'),
('BA','OLINDINA'),
('BA','OLIVEIRA DOS BREJINHOS'),
('SP','ORIENTE'),
('SP','ORLANDIA'),
('PE','OROBO'),
('PE','OROCO'),
('CE','OROS'),
('BA','OURICANGAS'),
('PE','OURICURI'),
('SP','OURINHOS'),
('RN','OURO BRANCO'),
('BA','OUROLANDIA'),
('CE','PACAJUS'),
('CE','PACATUBA'),
('CE','PACOTI'),
('CE','PACUJA'),
('RS','PAIM FILHO'),
('SP','PALESTINA'),
('CE','PALHANO'),
('CE','PALMACIA'),
('PE','PALMARES'),
('SP','PALMARES PAULISTA'),
('BA','PALMAS DE MONTE ALTO'),
('RS','PALMEIRA DAS MISSOES'),
('BA','PALMEIRAS'),
('PE','PALMEIRINA'),
('RS','PALMITINHO'),
('PE','PANELAS'),
('CE','PARACURU'),
('RS','PARAI'),
('CE','PARAIPABA'),
('SP','PARAISO'),
('RS','PARAISO DO SUL'),
('CE','PARAMBU'),
('BA','PARAMIRIM'),
('CE','PARAMOTI'),
('RN','PARANA');

INSERT INTO tmp_crefaz_cities (state, city) VALUES
('PE','PARANATAMA'),
('BA','PARATINGA'),
('RJ','PARATY'),
('RN','PARAU'),
('RN','PARAZINHO'),
('SP','PARDINHO'),
('RS','PARECI NOVO'),
('RN','PARELHAS'),
('BA','PARIPIRANGA'),
('PE','PARNAMIRIM'),
('RN','PARNAMIRIM'),
('RS','PAROBE'),
('RN','PASSA E FICA'),
('RN','PASSAGEM'),
('PE','PASSIRA'),
('RS','PASSO FUNDO'),
('SP','PATROCINIO PAULISTA'),
('RN','PATU'),
('BA','PAU BRASIL'),
('RN','PAU DOS FERROS'),
('PE','PAUDALHO'),
('SP','PAULINIA'),
('PE','PAULISTA'),
('SP','PAULISTANIA'),
('BA','PAULO AFONSO'),
('RS','PAULO BENTO'),
('BA','PE DE SERRA'),
('SP','PEDERNEIRAS'),
('PE','PEDRA'),
('CE','PEDRA BRANCA'),
('RN','PEDRA GRANDE'),
('RN','PEDRA PRETA'),
('BA','PEDRAO'),
('SP','PEDREGULHO'),
('SP','PEDREIRA'),
('BA','PEDRO ALEXANDRE'),
('RN','PEDRO AVELINO'),
('RN','PEDRO VELHO'),
('CE','PENAFORTE'),
('SP','PENAPOLIS'),
('RN','PENDENCIAS'),
('CE','PENTECOSTE'),
('CE','PEREIRO'),
('PE','PESQUEIRA'),
('PE','PETROLANDIA'),
('PE','PETROLINA'),
('RJ','PETROPOLIS'),
('SP','PIACATU'),
('BA','PIATA'),
('RS','PICADA CAFE'),
('BA','PILAO ARCADO'),
('RN','PILOES'),
('BA','PINDAI'),
('BA','PINDOBACU'),
('SP','PINDORAMA'),
('CE','PINDORETAMA'),
('RS','PINHAL DA SERRA'),
('RS','PINHAL GRANDE'),
('RS','PINHEIRINHO DO VALE'),
('BA','PINTADAS'),
('CE','PIQUET CARNEIRO'),
('SP','PIRACICABA'),
('BA','PIRAI DO NORTE'),
('SP','PIRAJU'),
('SP','PIRAJUI'),
('SP','PIRANGI'),
('RS','PIRAPO'),
('SP','PIRATININGA'),
('CE','PIRES FERREIRA'),
('BA','PIRIPA'),
('BA','PIRITIBA'),
('SP','PITANGUEIRAS'),
('BA','PLANALTINO'),
('BA','PLANALTO'),
('RS','PLANALTO'),
('PE','POCAO'),
('RN','POCO BRANCO'),
('BA','POCOES'),
('BA','POJUCA'),
('SP','POLONI'),
('PE','POMBOS'),
('SP','POMPEIA'),
('SP','PONGAI'),
('SP','PONTAL'),
('RS','PONTE PRETA'),
('BA','PONTO NOVO'),
('CE','PORANGA'),
('RJ','PORCIUNCULA'),
('RN','PORTALEGRE'),
('RS','PORTAO'),
('CE','PORTEIRAS'),
('RN','PORTO DO MANGUE'),
('SP','PORTO FELIZ'),
('RS','PORTO MAUA'),
('RJ','PORTO REAL'),
('BA','PORTO SEGURO'),
('RS','PORTO XAVIER'),
('CE','POTENGI'),
('BA','POTIRAGUA'),
('SP','POTIRENDABA'),
('CE','POTIRETAMA'),
('BA','PRADO'),
('SP','PRADOPOLIS'),
('SP','PRAIA GRANDE'),
('SP','PRATANIA'),
('SP','PRESIDENTE ALVES'),
('BA','PRESIDENTE DUTRA'),
('BA','PRESIDENTE JANIO QUADROS'),
('RS','PRESIDENTE LUCENA'),
('BA','PRESIDENTE TANCREDO NEVES'),
('PE','PRIMAVERA'),
('RS','PROTASIO ALVES'),
('RN','PUREZA'),
('RS','PUTINGA'),
('RS','QUARAI'),
('RS','QUATRO IRMAOS'),
('BA','QUEIMADAS'),
('SP','QUEIROZ'),
('RS','QUEVEDOS'),
('BA','QUIJINGUE'),
('SP','QUINTANA'),
('PE','QUIPAPA'),
('RJ','QUISSAMA'),
('CE','QUITERIANOPOLIS'),
('PE','QUIXABA'),
('BA','QUIXABEIRA'),
('CE','QUIXADA'),
('CE','QUIXELO'),
('CE','QUIXERAMOBIM'),
('CE','QUIXERE'),
('RN','RAFAEL FERNANDES'),
('RN','RAFAEL GODEIRO'),
('BA','RAFAEL JAMBEIRO'),
('SP','RAFARD'),
('PE','RECIFE'),
('CE','REDENCAO'),
('RS','REDENTORA'),
('SP','REGINOPOLIS'),
('RS','RELVADO'),
('BA','REMANSO'),
('CE','RERIUTABA'),
('SP','RESTINGA'),
('BA','RETIROLANDIA'),
('BA','RIACHAO DAS NEVES'),
('BA','RIACHAO DO JACUIPE'),
('RN','RIACHO DA CRUZ'),
('PE','RIACHO DAS ALMAS'),
('BA','RIACHO DE SANTANA'),
('RN','RIACHO DE SANTANA'),
('RN','RIACHUELO'),
('BA','RIBEIRA DO AMPARO'),
('BA','RIBEIRA DO POMBAL'),
('PE','RIBEIRAO'),
('SP','RIBEIRAO BONITO'),
('PR','RIBEIRAO CLARO'),
('SP','RIBEIRAO CORRENTE'),
('BA','RIBEIRAO DO LARGO'),
('SP','RIBEIRAO PRETO'),
('SP','RIFAINA'),
('SP','RINCAO'),
('RJ','RIO BONITO'),
('RJ','RIO DAS OSTRAS'),
('SP','RIO DAS PEDRAS'),
('BA','RIO DE CONTAS'),
('BA','RIO DO ANTONIO'),
('RN','RIO DO FOGO'),
('BA','RIO DO PIRES'),
('PE','RIO FORMOSO'),
('RS','RIO PARDO'),
('RS','RIOZINHO'),
('RS','ROCA SALES'),
('BA','RODELAS'),
('RN','RODOLFO FERNANDES'),
('RS','ROLANTE'),
('RS','RONDINHA'),
('RS','ROQUE GONZALES'),
('RS','ROSARIO DO SUL'),
('SP','RUBIACEA'),
('CE','RUSSAS'),
('BA','RUY BARBOSA'),
('RN','RUY BARBOSA'),
('SP','SABINO'),
('CE','SABOEIRO'),
('PE','SAIRE'),
('SP','SALES OLIVEIRA'),
('PE','SALGADINHO'),
('PE','SALGUEIRO'),
('BA','SALINAS DA MARGARIDA'),
('CE','SALITRE'),
('PE','SALOA'),
('SP','SALTINHO'),
('SP','SALTO'),
('SP','SALTO DE PIRAPORA'),
('RS','SALTO DO JACUI'),
('BA','SALVADOR'),
('RS','SANANDUVA'),
('PE','SANHARO'),
('RS','SANT ANA DO LIVRAMENTO'),
('SP','SANTA ADELIA'),
('BA','SANTA BARBARA'),
('SP','SANTA BARBARA D OESTE'),
('BA','SANTA BRIGIDA'),
('PE','SANTA CRUZ'),
('RN','SANTA CRUZ'),
('BA','SANTA CRUZ CABRALIA'),
('PE','SANTA CRUZ DA BAIXA VERDE'),
('SP','SANTA CRUZ DA ESPERANCA'),
('BA','SANTA CRUZ DA VITORIA'),
('PE','SANTA CRUZ DO CAPIBARIBE'),
('SP','SANTA CRUZ DO RIO PARDO'),
('RS','SANTA CRUZ DO SUL'),
('SP','SANTA ERNESTINA'),
('PE','SANTA FILOMENA'),
('BA','SANTA INES'),
('SP','SANTA LUCIA'),
('BA','SANTA LUZIA'),
('RS','SANTA MARGARIDA DO SUL'),
('RN','SANTA MARIA'),
('RS','SANTA MARIA'),
('PE','SANTA MARIA DA BOA VISTA'),
('SP','SANTA MARIA DA SERRA'),
('BA','SANTA MARIA DA VITORIA'),
('PE','SANTA MARIA DO CAMBUCA'),
('RS','SANTA MARIA DO HERVAL'),
('RJ','SANTA MARIA MADALENA'),
('CE','SANTA QUITERIA'),
('BA','SANTA RITA DE CASSIA'),
('RS','SANTA ROSA'),
('SP','SANTA ROSA DE VITERBO'),
('RS','SANTA TEREZA'),
('PE','SANTA TEREZINHA'),
('BA','SANTALUZ'),
('BA','SANTANA'),
('RS','SANTANA DA BOA VISTA'),
('CE','SANTANA DO ACARAU'),
('CE','SANTANA DO CARIRI'),
('RN','SANTANA DO MATOS'),
('RN','SANTANA DO SERIDO'),
('BA','SANTANOPOLIS'),
('RS','SANTIAGO'),
('BA','SANTO AMARO'),
('RS','SANTO ANGELO'),
('RN','SANTO ANTONIO'),
('SP','SANTO ANTONIO DA ALEGRIA'),
('BA','SANTO ANTONIO DE JESUS'),
('RJ','SANTO ANTONIO DE PADUA'),
('SP','SANTO ANTONIO DO ARACANGUA'),
('SP','SANTO ANTONIO DO JARDIM'),
('RS','SANTO ANTONIO DO PALMA'),
('RS','SANTO AUGUSTO'),
('RS','SANTO CRISTO'),
('BA','SANTO ESTEVAO'),
('SP','SANTOPOLIS DO AGUAPEI'),
('SP','SANTOS'),
('CE','SAO BENEDITO'),
('PE','SAO BENEDITO DO SUL'),
('RN','SAO BENTO DO NORTE'),
('RN','SAO BENTO DO TRAIRI'),
('PE','SAO BENTO DO UNA'),
('RS','SAO BORJA'),
('PE','SAO CAITANO'),
('SP','SAO CARLOS'),
('BA','SAO DESIDERIO'),
('BA','SAO DOMINGOS'),
('RS','SAO DOMINGOS DO SUL'),
('BA','SAO FELIPE'),
('BA','SAO FELIX'),
('BA','SAO FELIX DO CORIBE'),
('RN','SAO FERNANDO'),
('RJ','SAO FIDELIS'),
('RS','SAO FRANCISCO DE ASSIS'),
('RJ','SAO FRANCISCO DE ITABAPOANA'),
('RS','SAO FRANCISCO DE PAULA'),
('BA','SAO FRANCISCO DO CONDE'),
('RN','SAO FRANCISCO DO OESTE'),
('BA','SAO GABRIEL'),
('RS','SAO GABRIEL'),
('RJ','SAO GONCALO'),
('RN','SAO GONCALO DO AMARANTE'),
('CE','SAO GONCALO DO AMARANTE'),
('BA','SAO GONCALO DOS CAMPOS'),
('PE','SAO JOAO'),
('RJ','SAO JOAO DA BARRA'),
('RS','SAO JOAO DA URTIGA'),
('CE','SAO JOAO DO JAGUARIBE'),
('RN','SAO JOAO DO SABUGI'),
('SP','SAO JOAQUIM DA BARRA'),
('PE','SAO JOAQUIM DO MONTE'),
('RS','SAO JORGE'),
('SP','SAO JOSE DA BELA VISTA'),
('PE','SAO JOSE DA COROA GRANDE'),
('BA','SAO JOSE DA VITORIA'),
('RS','SAO JOSE DAS MISSOES'),
('RN','SAO JOSE DE MIPIBU'),
('RJ','SAO JOSE DE UBA'),
('PE','SAO JOSE DO BELMONTE'),
('RN','SAO JOSE DO CAMPESTRE'),
('PE','SAO JOSE DO EGITO'),
('RS','SAO JOSE DO HERVAL'),
('RS','SAO JOSE DO HORTENCIO'),
('RS','SAO JOSE DO INHACORA'),
('BA','SAO JOSE DO JACUIPE'),
('RS','SAO JOSE DO OURO'),
('SP','SAO JOSE DO RIO PARDO'),
('SP','SAO JOSE DO RIO PRETO'),
('RN','SAO JOSE DO SERIDO'),
('RJ','SAO JOSE DO VALE DO RIO PRETO'),
('RS','SAO JOSE DOS AUSENTES'),
('RS','SAO LEOPOLDO'),
('PE','SAO LOURENCO DA MATA'),
('CE','SAO LUIS DO CURU'),
('SP','SAO MANUEL'),
('RS','SAO MARCOS'),
('RS','SAO MARTINHO'),
('RS','SAO MARTINHO DA SERRA'),
('RN','SAO MIGUEL'),
('SP','SAO MIGUEL ARCANJO'),
('BA','SAO MIGUEL DAS MATAS'),
('RN','SAO MIGUEL DO GOSTOSO'),
('RS','SAO NICOLAU'),
('RN','SAO PAULO DO POTENGI'),
('SP','SAO PEDRO'),
('RN','SAO PEDRO'),
('RJ','SAO PEDRO DA ALDEIA'),
('RS','SAO PEDRO DAS MISSOES'),
('RS','SAO PEDRO DO BUTIA'),
('RS','SAO PEDRO DO SUL'),
('SP','SAO PEDRO DO TURVO'),
('RN','SAO RAFAEL'),
('SP','SAO ROQUE'),
('SP','SAO SEBASTIAO DA GRAMA'),
('RJ','SAO SEBASTIAO DO ALTO'),
('RS','SAO SEBASTIAO DO CAI'),
('BA','SAO SEBASTIAO DO PASSE'),
('RS','SAO SEPE'),
('SP','SAO SIMAO'),
('RN','SAO TOME'),
('RS','SAO VALENTIM'),
('RS','SAO VALENTIM DO SUL'),
('RS','SAO VENDELINO'),
('SP','SAO VICENTE'),
('RN','SAO VICENTE'),
('RS','SAO VICENTE DO SUL'),
('PE','SAO VICENTE FERRER'),
('BA','SAPEACU'),
('RS','SAPIRANGA'),
('RS','SAPUCAIA DO SUL'),
('RJ','SAQUAREMA'),
('RS','SARANDI'),
('SP','SARAPUI'),
('SP','SARUTAIA'),
('BA','SATIRO DIAS'),
('BA','SAUBARA'),
('BA','SAUDE'),
('BA','SEABRA'),
('BA','SEBASTIAO LARANJEIRAS'),
('RS','SEBERI'),
('RS','SEDE NOVA'),
('RS','SEGREDO'),
('RN','SENADOR ELOI DE SOUZA'),
('RN','SENADOR GEORGINO AVELINO'),
('CE','SENADOR POMPEU'),
('CE','SENADOR SA'),
('BA','SENHOR DO BONFIM'),
('BA','SENTO SE'),
('RS','SERAFINA CORREA'),
('SP','SERRA AZUL'),
('RN','SERRA CAIADA'),
('RN','SERRA DE SAO BENTO'),
('RN','SERRA DO MEL'),
('BA','SERRA DO RAMALHO'),
('BA','SERRA DOURADA'),
('SP','SERRA NEGRA'),
('RN','SERRA NEGRA DO NORTE'),
('BA','SERRA PRETA'),
('PE','SERRA TALHADA'),
('SP','SERRANA'),
('BA','SERRINHA'),
('RN','SERRINHA'),
('RN','SERRINHA DOS PINTOS'),
('PE','SERRITA'),
('BA','SERROLANDIA'),
('PE','SERTANIA'),
('SP','SERTAOZINHO'),
('RS','SEVERIANO DE ALMEIDA'),
('RN','SEVERIANO MELO'),
('SP','SEVERINIA'),
('RJ','SILVA JARDIM'),
('BA','SIMOES FILHO'),
('RS','SINIMBU'),
('PE','SIRINHAEM'),
('BA','SITIO DO MATO'),
('BA','SITIO DO QUINTO'),
('RN','SITIO NOVO'),
('BA','SOBRADINHO'),
('RS','SOBRADINHO'),
('CE','SOBRAL'),
('SP','SOCORRO'),
('RS','SOLEDADE'),
('PE','SOLIDAO'),
('CE','SOLONOPOLE'),
('SP','SOROCABA'),
('BA','SOUTO SOARES'),
('SP','SUMARE'),
('PE','SURUBIM'),
('SP','TABATINGA'),
('PE','TABIRA'),
('BA','TABOCAS DO BREJO VELHO'),
('RN','TABOLEIRO GRANDE'),
('CE','TABULEIRO DO NORTE'),
('PE','TACAIMBO'),
('PE','TACARATU'),
('SP','TAGUAI'),
('SP','TAIACU'),
('RN','TAIPU'),
('SP','TAIUVA'),
('PE','TAMANDARE'),
('CE','TAMBORIL'),
('SP','TANABI'),
('RN','TANGARA'),
('RJ','TANGUA'),
('BA','TANHACU'),
('BA','TANQUE NOVO'),
('BA','TANQUINHO'),
('BA','TAPEROA'),
('BA','TAPIRAMUTA'),
('SP','TAPIRATIBA'),
('RS','TAQUARA'),
('SP','TAQUARAL'),
('SP','TAQUARITINGA'),
('PE','TAQUARITINGA DO NORTE'),
('SP','TAQUARITUBA'),
('RS','TAQUARUCU DO SUL'),
('CE','TARRAFAS'),
('CE','TAUA'),
('BA','TEIXEIRA DE FREITAS'),
('CE','TEJUCUOCA'),
('SP','TEJUPA'),
('RN','TENENTE ANANIAS'),
('RN','TENENTE LAURENTINO CRUZ'),
('RS','TENENTE PORTELA'),
('BA','TEODORO SAMPAIO'),
('BA','TEOFILANDIA'),
('BA','TEOLANDIA'),
('RJ','TERESOPOLIS'),
('PE','TEREZINHA'),
('BA','TERRA NOVA'),
('PE','TERRA NOVA'),
('SP','TERRA ROXA'),
('CE','TIANGUA'),
('RN','TIBAU'),
('RN','TIBAU DO SUL'),
('PE','TIMBAUBA'),
('RN','TIMBAUBA DOS BATISTAS'),
('SP','TIMBURI'),
('PE','TORITAMA'),
('RS','TOROPI'),
('SP','TORRINHA'),
('RN','TOUROS'),
('SP','TRABIJU'),
('PE','TRACUNHAEM'),
('CE','TRAIRI'),
('RJ','TRAJANO DE MORAES'),
('BA','TREMEDAL'),
('RS','TRES ARROIOS'),
('RS','TRES COROAS'),
('RS','TRES PALMEIRAS'),
('RS','TRES PASSOS'),
('PE','TRINDADE'),
('RS','TRINDADE DO SUL'),
('PE','TRIUNFO'),
('RN','TRIUNFO POTIGUAR'),
('BA','TUCANO'),
('RS','TUCUNDUVA'),
('PE','TUPANATINGA'),
('RS','TUPANDI'),
('RS','TUPARENDI'),
('PE','TUPARETAMA'),
('CE','TURURU'),
('BA','UAUA'),
('BA','UBAIRA'),
('BA','UBAITABA'),
('CE','UBAJARA'),
('SP','UBARANA'),
('BA','UBATA'),
('SP','UBIRAJARA'),
('SP','UCHOA'),
('BA','UIBAI'),
('CE','UMARI'),
('RN','UMARIZAL'),
('BA','UMBURANAS'),
('CE','UMIRIM'),
('BA','UNA'),
('RS','UNIAO DA SERRA'),
('RN','UPANEMA'),
('BA','URANDI'),
('SP','URU'),
('CE','URUBURETAMA'),
('BA','URUCUCA'),
('RS','URUGUAIANA');

INSERT INTO tmp_crefaz_cities (state, city) VALUES
('CE','URUOCA'),
('BA','UTINGA'),
('RS','VACARIA'),
('RS','VALE DO SOL'),
('RS','VALE REAL'),
('BA','VALENCA'),
('BA','VALENTE'),
('SP','VALINHOS'),
('SP','VALPARAISO'),
('RS','VANINI'),
('CE','VARJOTA'),
('RJ','VARRE-SAI'),
('RN','VARZEA'),
('CE','VARZEA ALEGRE'),
('BA','VARZEA DA ROCA'),
('BA','VARZEA DO POCO'),
('BA','VARZEA NOVA'),
('SP','VARZEA PAULISTA'),
('BA','VARZEDO'),
('RS','VENANCIO AIRES'),
('RN','VENHA-VER'),
('PE','VENTUROSA'),
('SP','VERA CRUZ'),
('BA','VERA CRUZ'),
('RN','VERA CRUZ'),
('RS','VERA CRUZ'),
('RS','VERANOPOLIS'),
('PE','VERDEJANTE'),
('BA','VEREDA'),
('PE','VERTENTE DO LERIO'),
('PE','VERTENTES'),
('RS','VESPASIANO CORREA'),
('RS','VIADUTOS'),
('PE','VICENCIA'),
('RS','VICENTE DUTRA'),
('RN','VICOSA'),
('CE','VICOSA DO CEARA'),
('RN','VILA FLOR'),
('RS','VILA FLORES'),
('RS','VILA NOVA DO SUL'),
('SP','VINHEDO'),
('SP','VIRADOURO'),
('RS','VISTA ALEGRE'),
('SP','VISTA ALEGRE DO ALTO'),
('RS','VISTA ALEGRE DO PRATA'),
('RS','VISTA GAUCHA'),
('BA','VITORIA DA CONQUISTA'),
('PE','VITORIA DE SANTO ANTAO'),
('SP','VOTORANTIM'),
('BA','WAGNER'),
('BA','WANDERLEY'),
('BA','WENCESLAU GUIMARAES'),
('PE','XEXEU'),
('BA','XIQUE-XIQUE');

-- Leads com endereco na lista Crefaz (nome, cpf, telefone)
SELECT DISTINCT
  l.name AS nome,
  l.cpf AS cpf,
  COALESCE(NULLIF(l.phone, ''), lip.phone_primary, lip.phone_secondary) AS telefone
FROM leads l
INNER JOIN lead_inss_personal_profiles lip ON lip.lead_id = l.id
INNER JOIN tmp_crefaz_cities tc
  ON tc.state = UPPER(TRIM(lip.address_state))
 AND tc.city = UPPER(TRIM(lip.address_city))
WHERE l.business_type = 'consignado_inss';
