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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: F = None
        self.p: F = None
        self.u: B = None
        self.z: G = None
        self.q: A = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: C = None
        self.q: G = None
        self.o: G = None
        self.s: G = None
        self.p: E = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: H = None
        self.r: A = None
        self.s: E = None
        self.v: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

n = A("n")
l = B("l")
g = C("g")
d = D("d")
m = E("m")
e = F("e")
j = G("j")
c = H("c")
h = G("h")

n.y = h
n.u = l
n.v = g
l.r = d
g.t = d
g.q = l
g.r = m
d.y = g
m.x = l
m.u = l
m.w = e
m.p = e
m.z = j
m.v = j
m.q = n
e.y = n
e.u = g
e.q = j
e.s = j
e.o = h
e.p = m
e.r = c
j.u = m
j.s = m
j.q = c
j.r = n
j.v = g
c.y = g
h.u = m
h.s = m
h.q = c
h.r = n
h.v = g
assert g.t.y.r.w.u.r.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.u: B = None
        self.v: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.w: F = None
        self.p: F = None
        self.u: B = None
        self.z: G = None
        self.q: A = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: C = None
        self.q: G = None
        self.o: G = None
        self.s: G = None
        self.p: E = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: H = None
        self.r: A = None
        self.s: E = None
        self.v: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

n = A("n")
l = B("l")
g = C("g")
d = D("d")
m = E("m")
e = F("e")
j = G("j")
c = H("c")
h = G("h")

n.y = h
n.u = l
n.v = g
l.r = d
g.t = d
g.q = l
g.r = m
d.y = g
m.x = l
m.u = l
m.w = e
m.p = e
m.z = j
m.v = j
m.q = n
e.y = n
e.u = g
e.q = j
e.s = j
e.o = h
e.p = m
e.r = c
j.u = m
j.s = m
j.q = c
j.r = n
j.v = g
c.y = g
h.u = m
h.s = m
h.q = c
h.r = n
h.v = g
assert g.t.y.r.w.u.r.x.r.txt == "d"