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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: C = None
        self.q: E = None
        self.w: H = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: H = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: C = None
        self.q: E = None
        self.w: H = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: H = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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