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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: I = None
        self.v: H = None
        self.s: H = None
        self.o: B = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: J = None
        self.t: A = None
        self.w: I = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.v: J = None
        self.u: J = None
        self.y: E = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: J = None
        self.r: G = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: F = None
        self.r: G = None
        self.t: A = None
        self.x: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: I = None
        self.v: H = None
        self.s: H = None
        self.o: B = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: J = None
        self.t: A = None
        self.w: I = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.v: J = None
        self.u: J = None
        self.y: E = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: J = None
        self.r: G = None
        self.s: D = None
        self.q: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: F = None
        self.r: G = None
        self.t: A = None
        self.x: A = None
        self.txt = txt

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

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