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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: A = None
        self.r: E = None
        self.v: G = None
        self.q: I = None
        self.z: I = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: D = None
        self.w: A = None
        self.q: I = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: E = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: I = None
        self.v: A = None
        self.x: A = None
        self.p: H = None
        self.t: C = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: F = None
        self.v: A = None
        self.s: I = None
        self.p: E = None
        self.o: B = None
        self.t: A = None
        self.q: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: A = None
        self.r: E = None
        self.v: G = None
        self.q: I = None
        self.z: I = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: D = None
        self.w: A = None
        self.q: I = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: E = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: I = None
        self.v: A = None
        self.x: A = None
        self.p: H = None
        self.t: C = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: F = None
        self.v: A = None
        self.s: I = None
        self.p: E = None
        self.o: B = None
        self.t: A = None
        self.q: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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