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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: F = None
        self.p: A = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: B = None
        self.u: D = None
        self.s: B = None
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: C = None
        self.s: E = None
        self.w: C = None
        self.q: D = None
        self.y: F = None
        self.txt = txt

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

g = A("g")
c = B("c")
d = C("d")
n = D("n")
j = E("j")
e = F("e")
a = E("a")

g.p = c
g.x = c
g.s = a
g.q = a
c.w = n
c.z = e
c.r = e
c.p = g
d.w = a
d.o = a
d.p = c
d.s = c
d.u = n
d.v = j
n.y = g
n.o = g
n.q = a
j.v = a
j.s = a
j.o = d
j.w = d
j.q = n
j.y = e
e.w = c
e.u = n
a.v = j
a.s = j
a.o = d
a.w = d
a.q = n
a.y = e
assert d.p.w.y.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: E = None
        self.x: B = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: F = None
        self.p: A = None
        self.r: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: B = None
        self.u: D = None
        self.s: B = None
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: C = None
        self.s: E = None
        self.w: C = None
        self.q: D = None
        self.y: F = None
        self.txt = txt

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

g = A("g")
c = B("c")
d = C("d")
n = D("n")
j = E("j")
e = F("e")
a = E("a")

g.p = c
g.x = c
g.s = a
g.q = a
c.w = n
c.z = e
c.r = e
c.p = g
d.w = a
d.o = a
d.p = c
d.s = c
d.u = n
d.v = j
n.y = g
n.o = g
n.q = a
j.v = a
j.s = a
j.o = d
j.w = d
j.q = n
j.y = e
e.w = c
e.u = n
a.v = j
a.s = j
a.o = d
a.w = d
a.q = n
a.y = e
assert d.p.w.y.p.w.txt == "n"