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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: A = None
        self.v: B = None
        self.txt = txt

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

h.o = j
h.w = l
h.r = k
g.s = l
g.y = h
l.x = k
l.r = j
l.v = g
e.s = l
e.y = j
j.o = h
j.w = l
j.r = k
k.s = c
k.y = h
c.x = k
c.r = j
c.v = e
assert g.y.r.y.r.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: A = None
        self.v: B = None
        self.txt = txt

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

h.o = j
h.w = l
h.r = k
g.s = l
g.y = h
l.x = k
l.r = j
l.v = g
e.s = l
e.y = j
j.o = h
j.w = l
j.r = k
k.s = c
k.y = h
c.x = k
c.r = j
c.v = e
assert g.y.r.y.r.y.w.txt == "l"