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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: D = None
        self.w: C = None
        self.r: A = None
        self.p: F = None
        self.s: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.r: C = None
        self.y: G = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

n = A("n")
h = B("h")
m = C("m")
a = D("a")
b = E("b")
d = F("d")
e = G("e")
g = C("g")

n.s = g
n.o = d
n.u = m
h.o = n
h.r = n
h.t = a
h.w = g
h.p = d
h.s = d
m.z = a
m.o = h
m.t = h
m.r = g
m.y = e
a.w = e
a.y = g
b.x = e
d.w = n
e.z = a
g.z = a
g.o = h
g.t = h
g.r = m
g.y = e
assert d.w.u.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: F = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: D = None
        self.w: C = None
        self.r: A = None
        self.p: F = None
        self.s: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.r: C = None
        self.y: G = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

n = A("n")
h = B("h")
m = C("m")
a = D("a")
b = E("b")
d = F("d")
e = G("e")
g = C("g")

n.s = g
n.o = d
n.u = m
h.o = n
h.r = n
h.t = a
h.w = g
h.p = d
h.s = d
m.z = a
m.o = h
m.t = h
m.r = g
m.y = e
a.w = e
a.y = g
b.x = e
d.w = n
e.z = a
g.z = a
g.o = h
g.t = h
g.r = m
g.y = e
assert d.w.u.o.s.txt == "d"