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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: J = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: H = None
        self.v: A = None
        self.x: H = None
        self.q: D = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: J = None
        self.w: J = None
        self.z: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: G = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.t: F = None
        self.q: G = None
        self.o: G = None
        self.x: A = None
        self.w: I = None
        self.p: G = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: J = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: H = None
        self.v: A = None
        self.x: H = None
        self.q: D = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: J = None
        self.w: J = None
        self.z: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: G = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.t: F = None
        self.q: G = None
        self.o: G = None
        self.x: A = None
        self.w: I = None
        self.p: G = None
        self.txt = txt

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

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