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

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

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

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

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

n = A("n")
f = B("f")
l = C("l")
c = D("c")
a = E("a")
g = A("g")
k = D("k")

n.x = l
n.s = g
n.p = a
f.w = a
f.v = a
f.y = k
f.p = k
l.o = c
l.p = c
l.z = g
l.s = g
l.v = a
c.t = a
a.r = n
a.w = l
g.x = l
g.s = n
g.p = a
k.t = a
assert k.t.r.p.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

n = A("n")
f = B("f")
l = C("l")
c = D("c")
a = E("a")
g = A("g")
k = D("k")

n.x = l
n.s = g
n.p = a
f.w = a
f.v = a
f.y = k
f.p = k
l.o = c
l.p = c
l.z = g
l.s = g
l.v = a
c.t = a
a.r = n
a.w = l
g.x = l
g.s = n
g.p = a
k.t = a
assert k.t.r.p.r.p.txt == "a"