class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: F = None
        self.q: D = None
        self.o: D = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: D = None
        self.r: E = None
        self.t: B = None
        self.u: G = None
        self.q: B = None
        self.x: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: E = None
        self.u: A = None
        self.v: G = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: F = None
        self.u: G = None
        self.v: H = None
        self.y: H = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

j = A("j")
d = B("d")
e = C("e")
a = D("a")
g = E("g")
k = F("k")
f = G("f")
n = H("n")

j.r = e
d.s = e
d.r = e
d.y = k
d.q = a
d.o = a
e.o = f
e.u = f
e.y = a
e.r = g
e.t = d
e.q = d
e.x = j
a.t = k
a.z = g
a.u = j
a.v = f
a.o = f
g.q = j
g.s = k
g.u = f
g.v = n
g.y = n
g.w = d
k.q = g
k.z = f
f.u = n
n.z = g
assert d.q.z.q.r.y.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: F = None
        self.q: D = None
        self.o: D = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: D = None
        self.r: E = None
        self.t: B = None
        self.u: G = None
        self.q: B = None
        self.x: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: E = None
        self.u: A = None
        self.v: G = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: F = None
        self.u: G = None
        self.v: H = None
        self.y: H = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

j = A("j")
d = B("d")
e = C("e")
a = D("a")
g = E("g")
k = F("k")
f = G("f")
n = H("n")

j.r = e
d.s = e
d.r = e
d.y = k
d.q = a
d.o = a
e.o = f
e.u = f
e.y = a
e.r = g
e.t = d
e.q = d
e.x = j
a.t = k
a.z = g
a.u = j
a.v = f
a.o = f
g.q = j
g.s = k
g.u = f
g.v = n
g.y = n
g.w = d
k.q = g
k.z = f
f.u = n
n.z = g
assert d.q.z.q.r.y.t.q.txt == "g"