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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: B = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

n.w = c
n.s = e
c.v = g
c.z = j
c.t = f
i.q = c
f.y = d
f.q = d
f.s = n
d.w = n
d.u = n
d.y = n
d.t = g
j.v = i
j.z = c
j.t = f
e.q = j
g.q = c
assert n.s.q.z.z.v.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: B = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

n.w = c
n.s = e
c.v = g
c.z = j
c.t = f
i.q = c
f.y = d
f.q = d
f.s = n
d.w = n
d.u = n
d.y = n
d.t = g
j.v = i
j.z = c
j.t = f
e.q = j
g.q = c
assert n.s.q.z.z.v.q.t.txt == "f"