class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: F = None
        self.q: C = None
        self.v: F = None
        self.s: E = 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.x: D = None
        self.p: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.v: C = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: A = None
        self.x: C = None
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: C = None
        self.r: E = None
        self.txt = txt

j = A("j")
i = B("i")
n = C("n")
a = D("a")
g = E("g")
m = F("m")
e = C("e")

j.u = m
j.z = m
j.v = m
j.q = n
j.s = g
i.q = a
n.x = a
n.p = e
a.t = e
a.u = e
a.v = e
a.x = i
g.y = m
g.u = m
g.w = j
g.x = e
m.v = a
m.p = n
m.r = g
e.x = a
e.p = n
assert g.w.q.p.x.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: F = None
        self.q: C = None
        self.v: F = None
        self.s: E = 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.x: D = None
        self.p: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.v: C = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: A = None
        self.x: C = None
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: C = None
        self.r: E = None
        self.txt = txt

j = A("j")
i = B("i")
n = C("n")
a = D("a")
g = E("g")
m = F("m")
e = C("e")

j.u = m
j.z = m
j.v = m
j.q = n
j.s = g
i.q = a
n.x = a
n.p = e
a.t = e
a.u = e
a.v = e
a.x = i
g.y = m
g.u = m
g.w = j
g.x = e
m.v = a
m.p = n
m.r = g
e.x = a
e.p = n
assert g.w.q.p.x.x.q.txt == "a"