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

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

class C:
    def __init__(self, txt: str):
        self.z: I = None
        self.x: H = None
        self.r: H = None
        self.w: H = None
        self.s: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: I = None
        self.u: E = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: I = None
        self.x: H = None
        self.r: H = None
        self.w: H = None
        self.s: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: I = None
        self.u: E = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: D = None
        self.txt = txt

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

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