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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: G = None
        self.r: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: H = None
        self.o: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: G = None
        self.r: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: H = None
        self.o: D = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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