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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: G = None
        self.y: C = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: B = None
        self.w: F = None
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

j = A("j")
n = B("n")
h = C("h")
k = D("k")
m = E("m")
f = F("f")
i = G("i")
a = F("a")

j.q = a
j.x = h
n.u = j
n.z = i
n.y = h
n.t = h
h.w = j
h.y = i
k.s = n
m.q = h
m.o = h
f.v = m
f.q = n
f.w = a
f.r = k
i.x = m
a.v = m
a.q = n
a.w = f
a.r = k
assert n.u.x.w.x.w.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: G = None
        self.y: C = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: G = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: B = None
        self.w: F = None
        self.r: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

j = A("j")
n = B("n")
h = C("h")
k = D("k")
m = E("m")
f = F("f")
i = G("i")
a = F("a")

j.q = a
j.x = h
n.u = j
n.z = i
n.y = h
n.t = h
h.w = j
h.y = i
k.s = n
m.q = h
m.o = h
f.v = m
f.q = n
f.w = a
f.r = k
i.x = m
a.v = m
a.q = n
a.w = f
a.r = k
assert n.u.x.w.x.w.x.y.txt == "i"