# Java 8, 106 bytes <!-- language-all: lang-java --> A void lambda accepting a mutable `java.util.Set<String>`. s->{int i=0,a,b;while(i<49)if(s.add(""+(a=i/7)+(b=i++%7))&(s.add(""+b+a)|a==b))System.out.print(" "+a+b);} [Try It Online][tio] ## Ungolfed s -> { int i = 0, a, b; while (i < 49) if ( s.add("" + (a = i / 7) + (b = i++ % 7)) & ( s.add("" + b + a) | a == b ) ) System.out.print(" " + a + b); } [tio]: https://tio.run/##nZJPj9owEMXP4VM8RWplK5D6/6qwQap66aE9cVytKhPCrmlIUGx2tdry2WkSKqCUlaoebEeZ59/MeN7KPtnRavFjv9nOS5cjL633@GZdhddB9PunDza0x6rVptvgynS5rfLg6ir9XFd@uy6a21NsVoTbWWhc9TCdYolssPej6aurAlzGhnY4nzw/urIg7lZ9pG5JfGoXCxLHCbGZ@3BDEzLPXJK8u6H0/Sk4Tyz9abNsTunsxYdindbbkG7aNIHEiBObzOlktx9Ek8Fl2U@1W2DddkQOZd3dwzYPnnYNRlfrbhW59YVHBvKGgJ69xqemsS8@9aEp7Jq00KgqnnFM1qWJopgxMA4mwCSYAtNgBpyDC3AJrsA1uIEQEBJCQWgIAykhFaSGNFAKSkMZaA1tYEw8PKI561iCQfAOIRkkhxTdfcWgOJSAkh1CM2gOLaAltOpYhsFwGAEjYRSM/hP9P1X/S8lXoBfE80c44nrWCXQ4d@1Gu490bTfEYzRFO5BN6Xp30FPocmrjsfVfnQ/XFF@sfzwb@njcjvWgC3V/@2/t3f1RNWnXsm7ecFBvsO8YH4x28GK0TG2eF5tA@iDtCNGl28uK9IG2491gt/8F