class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: D = None
        self.w: E = None
        self.y: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: A = None
        self.r: E = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: C = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: B = None
        self.txt = txt

g = A("g")
m = B("m")
d = C("d")
h = D("h")
a = E("a")
i = E("i")
k = E("k")
n = A("n")

g.q = n
g.o = h
g.y = h
g.w = k
g.r = d
m.s = h
m.x = n
m.o = n
m.r = i
d.x = h
d.r = h
d.o = h
d.v = a
d.q = m
h.u = n
h.q = d
h.x = i
a.t = g
a.v = m
i.t = n
i.v = m
k.t = n
k.v = m
n.q = g
n.o = h
n.y = h
n.w = i
n.r = d
assert g.r.q.r.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: D = None
        self.w: E = None
        self.y: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: A = None
        self.r: E = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: C = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: B = None
        self.txt = txt

g = A("g")
m = B("m")
d = C("d")
h = D("h")
a = E("a")
i = E("i")
k = E("k")
n = A("n")

g.q = n
g.o = h
g.y = h
g.w = k
g.r = d
m.s = h
m.x = n
m.o = n
m.r = i
d.x = h
d.r = h
d.o = h
d.v = a
d.q = m
h.u = n
h.q = d
h.x = i
a.t = g
a.v = m
i.t = n
i.v = m
k.t = n
k.v = m
n.q = g
n.o = h
n.y = h
n.w = i
n.r = d
assert g.r.q.r.t.o.txt == "h"