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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: E = None
        self.r: C = None
        self.v: E = None
        self.q: I = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: A = None
        self.t: A = None
        self.r: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.p: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: E = None
        self.r: C = None
        self.v: E = None
        self.q: I = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: A = None
        self.t: A = None
        self.r: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.p: D = None
        self.t: C = None
        self.txt = txt

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

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