class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: F = None
        self.u: F = None
        self.q: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: G = None
        self.z: D = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: D = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: G = None
        self.z: D = None
        self.r: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: D = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: A = None
        self.txt = txt

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

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