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

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

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

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

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

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

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

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

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

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

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

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

n.z = g
n.t = g
n.u = g
k.o = g
k.y = g
k.w = g
c.u = n
c.q = n
c.p = g
e.w = g
e.y = k
e.p = k
e.u = c
g.w = k
g.s = k
g.z = e
g.x = e
g.p = c
assert g.z.u.q.u.txt == "g"