(
(let $1 (Bool 'true))
(let $2 (DataType 'String))
(let $3 '('"key" $2))
(let $4 '('('"_logical_id" '1879) '('"_id" '"9b03855b-6f9236cc-877f4003-c6dd8d7b") '('"_wide_channels" (StructType $3 '('"value" $2)))))
(let $5 (DqPhyStage '() (lambda '() (block '(
  (let $15 '@@["StructType";[["key";["DataType";"String"]];["subkey";["DataType";"String"]];["value";["DataType";"String"]]]]@@)
  (let $16 '('"key" '"subkey"))
  (let $17 (YqlRowSpec '('NativeYtTypeFlags '0) '('StrictSchema '1) '('UniqueKeys '0) '('Type $15) '('SortDirections '($1 $1)) '('SortMembers $16) '('SortedBy $16) '('SortedByTypes '($2 $2))))
  (let $18 (YtMeta '('CanWrite '1) '('DoesExist '1) '('YqlCompatibleScheme '1) '('InferredScheme '0) '('IsDynamic '0) '('Attrs '('('"native_strict_schema" '"false")))))
  (let $19 (YtStat '('Id '"Input") '('RecordsCount '"6") '('DataSize '"252") '('ChunkCount '1) '('ModifyTime '0) '('Revision '0)))
  (let $20 (YtTable '"Input" $17 $18 $19 '() (Void) (Void) '"/Root/plato"))
  (let $21 (YtReadTable! world (DataSource '"yt" '"/Root/plato") '((YtSection '((YtPath $20 '('"key" '"value") (Void) (Void))) '()))))
  (return (FromFlow (DqReadWideWrap $21 '())))
))) $4))
(let $6 (DqCnHashShuffle (TDqOutput $5 '0) '('0) '0 '"HashV2"))
(let $7 (StructType '('"cnt" (DataType 'Uint64)) $3 '('max $2) '('min $2)))
(let $8 '('('"_logical_id" '2100) '('"_id" '"559566f4-5f946d37-4a4d1c4b-1d99ffce") '('"_wide_channels" $7)))
(let $9 (DqPhyStage '($6) (lambda '($22) (block '(
  (let $23 (NarrowSqueezeToDict (ToFlow $22) (lambda '($27 $28) $27) (lambda '($29 $30) (AsStruct '('"key" $29) '('"value" $30))) '('Auto 'Many)))
  (let $24 (Condense1 (OrderedFlatMap $23 (lambda '($31) (OrderedFlatMap (DictPayloads $31) (lambda '($32) $32)))) (lambda '($33) (block '(
    (let $34 (Member $33 '"value"))
    (return (AsStruct '('_yql_agg_0 (Uint64 '1)) '('_yql_agg_1 $34) '('_yql_agg_2 $34) '('"key" (Member $33 '"key"))))
  ))) (lambda '($35 $36) (AggrNotEquals (Member $35 '"key") (Member $36 '"key"))) (lambda '($37 $38) (block '(
    (let $39 (Member $37 '"value"))
    (return (AsStruct '('_yql_agg_0 (Inc (Member $38 '_yql_agg_0))) '('_yql_agg_1 (AggrMax $39 (Member $38 '_yql_agg_1))) '('_yql_agg_2 (AggrMin $39 (Member $38 '_yql_agg_2))) '('"key" (Member $38 '"key"))))
  )))))
  (let $25 (Sort (Map $24 (lambda '($40) (AsStruct '('"cnt" (Member $40 '_yql_agg_0)) '('"key" (Member $40 '"key")) '('max (Member $40 '_yql_agg_1)) '('min (Member $40 '_yql_agg_2))))) $1 (lambda '($41) (Member $41 '"key"))))
  (let $26 (lambda '($42) (Member $42 '"cnt") (Member $42 '"key") (Member $42 'max) (Member $42 'min)))
  (return (FromFlow (ExpandMap $25 $26)))
))) $8))
(let $10 (DqCnMerge (TDqOutput $9 '0) '('('1 '"Asc"))))
(let $11 (DqPhyStage '($10) (lambda '($43) (FromFlow (NarrowMap (ToFlow $43) (lambda '($44 $45 $46 $47) (AsStruct '('"cnt" $44) '('"key" $45) '('max $46) '('min $47)))))) '('('"_logical_id" '2112) '('"_id" '"69cabdd1-f5c6dbb3-4602c5c8-42dbf2c4"))))
(let $12 '($5 $9 $11))
(let $13 '('"key" '"cnt" 'min 'max))
(let $14 (DqCnResult (TDqOutput $11 '0) $13))
(return (KqpPhysicalQuery '((KqpPhysicalTx $12 '($14) '() '('('"type" '"generic")))) '((KqpTxResultBinding (ListType $7) '0 '0)) '('('"type" '"query"))))
)
