class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.y: H = None
        self.s: D = None
        self.t: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.s: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: G = None
        self.o: A = None
        self.p: B = None
        self.u: E = None
        self.txt = txt

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

e.r = i
e.y = i
e.s = a
e.t = n
n.q = e
m.t = h
m.o = n
m.q = n
m.w = a
a.w = l
g.q = i
g.s = m
d.y = e
d.r = n
d.s = h
b.w = m
b.p = g
i.v = a
i.q = b
i.o = e
i.p = n
i.u = g
h.y = e
h.r = n
h.s = d
l.w = m
l.p = g
assert m.t.s.r.q.r.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.y: H = None
        self.s: D = None
        self.t: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.s: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: G = None
        self.o: A = None
        self.p: B = None
        self.u: E = None
        self.txt = txt

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

e.r = i
e.y = i
e.s = a
e.t = n
n.q = e
m.t = h
m.o = n
m.q = n
m.w = a
a.w = l
g.q = i
g.s = m
d.y = e
d.r = n
d.s = h
b.w = m
b.p = g
i.v = a
i.q = b
i.o = e
i.p = n
i.u = g
h.y = e
h.r = n
h.s = d
l.w = m
l.p = g
assert m.t.s.r.q.r.q.p.txt == "g"