class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: E = None
        self.w: F = None
        self.s: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: C = None
        self.z: C = None
        self.o: E = None
        self.r: E = None
        self.p: E = None
        self.txt = txt

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

d.p = l
d.q = i
d.s = i
d.w = j
e.q = i
e.y = i
e.p = m
m.x = d
a.w = m
a.x = m
a.o = m
a.q = h
i.u = m
i.x = m
i.q = d
h.z = e
n.s = i
n.o = i
n.r = i
n.p = i
n.w = m
n.z = m
l.s = i
l.o = i
l.r = i
l.p = i
l.w = m
l.z = m
f.q = i
f.y = i
f.p = m
j.z = e
assert e.p.x.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.q: E = None
        self.w: F = None
        self.s: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: C = None
        self.z: C = None
        self.o: E = None
        self.r: E = None
        self.p: E = None
        self.txt = txt

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

d.p = l
d.q = i
d.s = i
d.w = j
e.q = i
e.y = i
e.p = m
m.x = d
a.w = m
a.x = m
a.o = m
a.q = h
i.u = m
i.x = m
i.q = d
h.z = e
n.s = i
n.o = i
n.r = i
n.p = i
n.w = m
n.z = m
l.s = i
l.o = i
l.r = i
l.p = i
l.w = m
l.z = m
f.q = i
f.y = i
f.p = m
j.z = e
assert e.p.x.w.z.txt == "e"