class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: F = None
        self.t: D = None
        self.u: B = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: A = None
        self.r: G = None
        self.y: G = None
        self.w: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: C = None
        self.t: G = None
        self.q: F = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
e = B("e")
l = C("l")
g = D("g")
a = E("a")
h = F("h")
f = G("f")
i = F("i")

n.p = e
n.u = e
n.x = e
n.s = i
n.t = g
e.q = a
l.s = a
g.q = f
g.r = f
g.y = f
g.w = f
g.x = n
a.v = e
a.w = l
a.t = f
a.y = f
a.q = h
h.z = a
h.r = l
h.u = n
f.z = e
f.y = e
f.o = l
f.x = n
f.t = a
i.z = a
i.r = l
i.u = n
assert n.s.z.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: F = None
        self.t: D = None
        self.u: B = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: A = None
        self.r: G = None
        self.y: G = None
        self.w: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: C = None
        self.t: G = None
        self.q: F = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
e = B("e")
l = C("l")
g = D("g")
a = E("a")
h = F("h")
f = G("f")
i = F("i")

n.p = e
n.u = e
n.x = e
n.s = i
n.t = g
e.q = a
l.s = a
g.q = f
g.r = f
g.y = f
g.w = f
g.x = n
a.v = e
a.w = l
a.t = f
a.y = f
a.q = h
h.z = a
h.r = l
h.u = n
f.z = e
f.y = e
f.o = l
f.x = n
f.t = a
i.z = a
i.r = l
i.u = n
assert n.s.z.q.r.txt == "l"