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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: F = None
        self.y: C = None
        self.q: E = None
        self.p: I = None
        self.v: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: A = None
        self.v: H = None
        self.o: E = None
        self.txt = txt

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

n.p = e
d.p = g
d.o = h
e.y = n
e.s = n
e.q = d
g.x = b
g.q = b
g.u = f
g.v = f
g.y = e
g.p = c
b.q = d
b.x = n
b.o = i
b.w = h
b.r = h
b.z = e
b.y = g
f.z = d
l.q = i
l.u = e
l.v = g
l.t = g
l.p = d
h.w = i
c.x = n
c.y = n
c.v = i
c.o = b
i.w = h
assert n.p.s.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: F = None
        self.y: C = None
        self.q: E = None
        self.p: I = None
        self.v: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: A = None
        self.v: H = None
        self.o: E = None
        self.txt = txt

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

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