class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: C = None
        self.t: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

n.r = c
n.t = c
n.o = k
n.q = g
g.o = c
g.t = k
g.z = k
g.x = k
g.q = k
k.o = d
k.w = d
d.s = k
d.z = g
d.o = n
d.p = c
c.p = n
assert g.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.o: C = None
        self.t: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

n.r = c
n.t = c
n.o = k
n.q = g
g.o = c
g.t = k
g.z = k
g.x = k
g.q = k
k.o = d
k.w = d
d.s = k
d.z = g
d.o = n
d.p = c
c.p = n
assert g.o.p.o.txt == "k"