Return all the expressions in equal relations?

Given several sets containing equal relations ( in “=” or “==” relations) such as

seit1={a1=a2=a3}

or {a1==a2==a3},
set2={a2=b1=b2, b3=b4},or {a2==b1==b2, b3==b4},
How to get all expressions in the equal relation (including its transitive relations), like a1,a2,a3,b1,b2? when input any one of expressions in the relation (any one among a1,a2,a3,b1,b2)?

You should test it further, but did you perhaps mean this (it doesn’t work with “=”)?

<< Combinatorica`

eqs = {a2 == b1 == b2, b3 == b4}
head = Head[eqs[[1]]];
eqs /. head -> List;
Apply[head, (KSubsets[#, 2] & /@ List @@@ eqs), {2}]

Thanks?

These sentences are truly what I need:

eqs = {a2 == b1 == b2, b3 == b4};
head = Head[eqs[[1]]];
eqs /. head -> List;

It outputs {{a2 , b1 , b2}, {b3, b4}}.

But now it is needed to print a2 , b1 , b2 when input any one of a2 , b1 , b2; or print b3 and b4 when input any one among b3 and b4.
I tried to write these sentences :

SList=eqs /. head -> List;

SList[[1]];

If [Containing[SList[[1]],Input[] , Print[SList[[1]]],F]

Here hope printing a2 , b1 , b2 when input any one of a2 , b1 , b2 by justifying the input is contained in { a2 , b1 , b2} . But it does not run.Why?
Should there be a better approach to print the items in the “==” relationship like a2 , b1 , b2 when input any one of them?

I am afraid I don’t quite understand what you mean. But perhaps this helps a bit:

Take your set of equations

eqs = {Equal[a, b, c, d, e], Equal[u, v]}

and consider the following function

test[x_] := 
 If[MemberQ[# =!= Symbol & /@ Head /@ List @@ x, True], Print[x], 
  Print["Nothing to print"]]

Then

test /@ eqs;

Now assign a value to, say d

d = 5;
test /@ eqs;

Clear d and assign a value to u

d =.
u = 2;
test /@ eqs;

Clear u again and find there are no values assigned

u =.
test /@ eqs;

Now assign two values

v = 3;
b = 5.6;
test /@ eqs;

Your help truly beneficial!
I tried to rewrite the programs as follows which are similar:

eqs = {a2 == b1 == b2, b3 == b4};

Slist = List @@@ eqs;

If[ContainsAll[Flatten[SList[[1]]], Input[]], Print[SList[[1]]], F]

When input one of a2 ,b1, b2 in a brace, say {b1} , the output will be all of a2 ,b1, b2 (in relationship equal with the input).

And? Does it work?
My Mathematica (Version 7) doesn’t know ContainsAll.
What do you think about this? (Type x=1 in the Input field to leave the loop.)

eqs = {a2 == b1 == b2, b3 == b4};
test[x_] := 
 If[MemberQ[# =!= Symbol & /@ Head /@ List @@ x, True], Print[x], 
  Print["Nothing to print"]]

x = 0;
While[ x == 0,
 Input[];
 test /@ eqs;
 ]

It works well ! You really have good feelings in Mathematica programming!
Input a2=3, it will output 3== b1 == b2.

I suppose it is same as the prohrams

eqs = {a2 == b1 == b2, b3 == b4};

Slist = List @@@ eqs;

If[ContainsAll[Flatten[Slist[[1]]], Input[]], Print[Slist[[1]]], F]

(Slist was wrong in above as SList)

I searched the function ContainsAll. It is introduced since 2015 in Mathematica version 10.2.