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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: E = None
        self.r: B = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: G = None
        self.y: A = None
        self.z: C = None
        self.s: C = None
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: A = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: H = None
        self.t: D = None
        self.v: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: E = None
        self.r: B = None
        self.x: A = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: G = None
        self.y: A = None
        self.z: C = None
        self.s: C = None
        self.q: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: A = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: H = None
        self.t: D = None
        self.v: A = None
        self.o: C = None
        self.txt = txt

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

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

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