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

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.q: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: F = None
        self.u: I = None
        self.r: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: A = None
        self.w: C = None
        self.x: D = None
        self.t: E = None
        self.u: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.q: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: F = None
        self.u: I = None
        self.r: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: A = None
        self.w: C = None
        self.x: D = None
        self.t: E = None
        self.u: D = None
        self.txt = txt

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

a.r = d
a.v = d
a.q = c
f.z = h
f.q = l
i.o = c
n.t = d
g.s = a
g.q = a
g.o = a
g.u = d
g.x = h
g.r = n
g.w = i
c.w = n
c.t = l
d.o = n
d.t = c
d.u = l
d.r = f
h.z = f
h.v = a
l.p = f
l.v = a
l.w = i
l.x = n
l.u = n
l.t = g
assert g.u.u.v.q.t.v.q.w.t.txt == "d"