class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

e = A("e")
l = B("l")
a = A("a")
c = B("c")
n = A("n")
j = A("j")
g = A("g")

e.o = c
e.u = a
l.s = c
a.o = l
a.u = n
c.s = l
n.o = c
n.u = e
j.o = c
j.u = g
g.o = c
g.u = e
assert g.u.o.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

e = A("e")
l = B("l")
a = A("a")
c = B("c")
n = A("n")
j = A("j")
g = A("g")

e.o = c
e.u = a
l.s = c
a.o = l
a.u = n
c.s = l
n.o = c
n.u = e
j.o = c
j.u = g
g.o = c
g.u = e
assert g.u.o.s.s.txt == "c"