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

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

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

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

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

n = A("n")
m = B("m")
l = C("l")
b = D("b")
h = E("h")
c = C("c")
g = A("g")

n.y = l
n.w = m
n.x = g
m.y = b
l.s = h
l.z = g
l.r = c
l.w = m
b.q = m
b.w = c
h.v = c
c.s = h
c.z = g
c.r = l
c.w = m
g.y = l
g.w = m
g.x = n
assert n.x.w.y.q.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

n = A("n")
m = B("m")
l = C("l")
b = D("b")
h = E("h")
c = C("c")
g = A("g")

n.y = l
n.w = m
n.x = g
m.y = b
l.s = h
l.z = g
l.r = c
l.w = m
b.q = m
b.w = c
h.v = c
c.s = h
c.z = g
c.r = l
c.w = m
g.y = l
g.w = m
g.x = n
assert n.x.w.y.q.y.w.txt == "c"