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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: I = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: J = None
        self.s: J = None
        self.z: J = None
        self.w: G = None
        self.y: A = None
        self.q: F = None
        self.o: J = None
        self.p: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.x: I = None
        self.r: F = None
        self.y: I = None
        self.w: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: I = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: J = None
        self.s: J = None
        self.z: J = None
        self.w: G = None
        self.y: A = None
        self.q: F = None
        self.o: J = None
        self.p: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.x: I = None
        self.r: F = None
        self.y: I = None
        self.w: F = None
        self.txt = txt

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

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