class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: A = None
        self.txt = txt

e = A("e")
l = B("l")
h = C("h")
g = C("g")
j = B("j")
a = C("a")

e.v = l
e.w = l
e.y = j
l.q = a
l.o = a
h.s = g
h.o = e
g.s = h
g.o = e
j.q = h
j.o = a
a.s = h
a.o = e
assert h.s.s.o.w.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: B = None
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: A = None
        self.txt = txt

e = A("e")
l = B("l")
h = C("h")
g = C("g")
j = B("j")
a = C("a")

e.v = l
e.w = l
e.y = j
l.q = a
l.o = a
h.s = g
h.o = e
g.s = h
g.o = e
j.q = h
j.o = a
a.s = h
a.o = e
assert h.s.s.o.w.q.s.txt == "h"