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

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

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

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

c = A("c")
f = B("f")
h = C("h")
i = D("i")
m = D("m")
n = A("n")
a = C("a")
g = B("g")
e = D("e")

c.s = f
c.w = h
c.z = n
f.v = c
f.o = n
f.y = m
f.r = a
h.t = g
i.w = m
i.t = m
i.s = f
m.w = e
m.t = e
m.s = g
n.s = g
n.w = a
n.z = c
a.t = g
g.v = c
g.o = n
g.y = i
g.r = a
e.w = m
e.t = m
e.s = g
assert h.t.r.t.y.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: C = None
        self.z: A = None
        self.txt = txt

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

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

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

c = A("c")
f = B("f")
h = C("h")
i = D("i")
m = D("m")
n = A("n")
a = C("a")
g = B("g")
e = D("e")

c.s = f
c.w = h
c.z = n
f.v = c
f.o = n
f.y = m
f.r = a
h.t = g
i.w = m
i.t = m
i.s = f
m.w = e
m.t = e
m.s = g
n.s = g
n.w = a
n.z = c
a.t = g
g.v = c
g.o = n
g.y = i
g.r = a
e.w = m
e.t = m
e.s = g
assert h.t.r.t.y.s.o.s.txt == "g"