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

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: A = None
        self.u: F = None
        self.x: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: H = None
        self.v: E = None
        self.z: H = None
        self.r: I = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: H = None
        self.r: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.z: A = None
        self.txt = txt

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

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

a.u = m
a.z = m
a.y = e
a.q = i
a.w = j
a.r = n
a.p = c
a.v = b
e.r = m
i.s = j
i.z = a
i.u = g
i.x = c
j.p = i
c.u = a
g.u = a
g.o = m
g.z = m
g.v = c
g.r = n
g.x = e
b.u = i
b.w = m
b.r = e
m.y = i
m.x = g
m.z = a
n.u = g
assert b.r.r.x.u.y.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.y: B = None
        self.q: C = None
        self.w: D = None
        self.r: I = None
        self.p: E = None
        self.z: H = None
        self.v: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: A = None
        self.u: F = None
        self.x: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: H = None
        self.v: E = None
        self.z: H = None
        self.r: I = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: H = None
        self.r: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.z: A = None
        self.txt = txt

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

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

a.u = m
a.z = m
a.y = e
a.q = i
a.w = j
a.r = n
a.p = c
a.v = b
e.r = m
i.s = j
i.z = a
i.u = g
i.x = c
j.p = i
c.u = a
g.u = a
g.o = m
g.z = m
g.v = c
g.r = n
g.x = e
b.u = i
b.w = m
b.r = e
m.y = i
m.x = g
m.z = a
n.u = g
assert b.r.r.x.u.y.r.y.txt == "i"