class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: D = None
        self.u: B = None
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.x: D = None
        self.r: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: E = None
        self.v: H = None
        self.z: G = None
        self.q: D = None
        self.s: G = None
        self.o: G = None
        self.w: J = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: J = None
        self.u: A = None
        self.x: C = None
        self.o: D = None
        self.r: C = None
        self.z: F = None
        self.p: D = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

d = A("d")
j = B("j")
l = C("l")
a = D("a")
e = E("e")
m = F("m")
h = G("h")
f = H("f")
c = I("c")
g = J("g")

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

class B:
    def __init__(self, txt: str):
        self.w: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: E = None
        self.x: D = None
        self.r: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: E = None
        self.v: H = None
        self.z: G = None
        self.q: D = None
        self.s: G = None
        self.o: G = None
        self.w: J = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: J = None
        self.u: A = None
        self.x: C = None
        self.o: D = None
        self.r: C = None
        self.z: F = None
        self.p: D = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

d = A("d")
j = B("j")
l = C("l")
a = D("a")
e = E("e")
m = F("m")
h = G("h")
f = H("f")
c = I("c")
g = J("g")

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