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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.v: I = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: I = None
        self.z: B = None
        self.y: B = None
        self.o: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: D = None
        self.t: A = None
        self.w: G = None
        self.p: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.v: I = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: I = None
        self.z: B = None
        self.y: B = None
        self.o: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: D = None
        self.t: A = None
        self.w: G = None
        self.p: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: C = None
        self.txt = txt

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

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