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

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

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

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

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

j = A("j")
g = B("g")
c = C("c")
n = D("n")
e = E("e")
a = B("a")
h = C("h")
m = C("m")
f = B("f")
l = A("l")

j.w = e
j.r = n
g.v = f
c.y = m
n.s = c
n.p = c
n.w = e
e.x = l
a.v = g
h.y = c
m.y = h
f.v = g
l.w = e
l.r = n
assert j.w.x.r.p.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
c = C("c")
n = D("n")
e = E("e")
a = B("a")
h = C("h")
m = C("m")
f = B("f")
l = A("l")

j.w = e
j.r = n
g.v = f
c.y = m
n.s = c
n.p = c
n.w = e
e.x = l
a.v = g
h.y = c
m.y = h
f.v = g
l.w = e
l.r = n
assert j.w.x.r.p.y.y.y.y.y.y.txt == "c"