class A:
    def __init__(self, txt: str):
        self.z: I = None
        self.q: D = None
        self.t: H = None
        self.u: C = None
        self.v: B = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: E = None
        self.z: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: E = None
        self.z: G = None
        self.txt = txt

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

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