class A:
    def __init__(self, txt: str):
        self.r: H = None
        self.p: J = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

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

class J:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

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

class J:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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