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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: J = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: I = None
        self.s: I = None
        self.q: A = None
        self.t: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: J = None
        self.p: G = None
        self.u: B = None
        self.q: D = None
        self.o: J = None
        self.x: B = None
        self.r: B = None
        self.y: D = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: G = None
        self.s: H = None
        self.txt = txt

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

g = A("g")
m = B("m")
d = C("d")
f = D("f")
i = E("i")
b = F("b")
h = G("h")
c = H("c")
n = I("n")
j = J("j")

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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: J = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: I = None
        self.s: I = None
        self.q: A = None
        self.t: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: J = None
        self.p: G = None
        self.u: B = None
        self.q: D = None
        self.o: J = None
        self.x: B = None
        self.r: B = None
        self.y: D = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: G = None
        self.s: H = None
        self.txt = txt

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

g = A("g")
m = B("m")
d = C("d")
f = D("f")
i = E("i")
b = F("b")
h = G("h")
c = H("c")
n = I("n")
j = J("j")

g.w = h
g.z = m
g.u = j
m.q = f
d.t = m
d.w = j
f.q = g
f.p = d
f.r = m
i.y = n
i.s = n
i.q = g
i.t = c
b.w = d
b.t = j
b.o = j
b.p = h
b.u = m
b.x = m
b.r = m
b.q = f
b.y = f
h.r = c
c.p = m
n.x = m
n.p = h
n.s = c
j.z = f
assert d.t.q.q.z.q.p.t.q.txt == "f"