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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

n = A("n")
c = B("c")
g = C("g")
e = D("e")
k = E("k")
d = A("d")
f = E("f")

n.o = k
n.v = f
n.p = g
n.w = c
n.r = e
c.r = e
c.w = f
g.s = n
e.w = f
k.z = d
k.u = g
k.r = g
k.v = n
d.o = k
d.v = f
d.p = g
d.w = c
d.r = e
f.z = d
f.u = g
f.r = g
f.v = n
assert k.z.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: E = None
        self.p: C = None
        self.w: B = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

n = A("n")
c = B("c")
g = C("g")
e = D("e")
k = E("k")
d = A("d")
f = E("f")

n.o = k
n.v = f
n.p = g
n.w = c
n.r = e
c.r = e
c.w = f
g.s = n
e.w = f
k.z = d
k.u = g
k.r = g
k.v = n
d.o = k
d.v = f
d.p = g
d.w = c
d.r = e
f.z = d
f.u = g
f.r = g
f.v = n
assert k.z.p.s.p.txt == "g"