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

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: I = None
        self.q: E = None
        self.u: E = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: F = None
        self.r: E = None
        self.t: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: H = None
        self.q: C = None
        self.s: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: G = None
        self.r: G = None
        self.q: F = None
        self.txt = txt

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

a.u = i
i.z = n
i.v = l
i.q = g
i.u = g
i.s = g
d.x = e
e.q = i
e.t = i
e.v = f
e.r = g
g.s = d
g.z = d
g.y = e
g.r = l
g.x = n
f.y = e
f.v = l
n.t = a
n.u = m
n.q = d
n.s = k
m.x = a
m.q = g
l.o = f
l.q = f
l.v = n
l.r = n
k.u = i
assert i.v.q.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: I = None
        self.q: E = None
        self.u: E = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: F = None
        self.r: E = None
        self.t: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: H = None
        self.q: C = None
        self.s: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: G = None
        self.r: G = None
        self.q: F = None
        self.txt = txt

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

a.u = i
i.z = n
i.v = l
i.q = g
i.u = g
i.s = g
d.x = e
e.q = i
e.t = i
e.v = f
e.r = g
g.s = d
g.z = d
g.y = e
g.r = l
g.x = n
f.y = e
f.v = l
n.t = a
n.u = m
n.q = d
n.s = k
m.x = a
m.q = g
l.o = f
l.q = f
l.v = n
l.r = n
k.u = i
assert i.v.q.y.r.txt == "g"