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

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

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

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

e = A("e")
a = B("a")
m = C("m")
g = D("g")
j = A("j")
k = B("k")
n = C("n")

e.w = j
e.p = j
e.r = m
e.y = k
a.t = j
m.s = a
m.x = g
m.r = j
g.v = e
g.x = k
g.w = n
j.w = e
j.p = e
j.r = n
j.y = a
k.t = j
n.s = a
n.x = g
n.r = j
assert a.t.w.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: C = None
        self.p: A = None
        self.y: B = None
        self.txt = txt

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

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

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

e = A("e")
a = B("a")
m = C("m")
g = D("g")
j = A("j")
k = B("k")
n = C("n")

e.w = j
e.p = j
e.r = m
e.y = k
a.t = j
m.s = a
m.x = g
m.r = j
g.v = e
g.x = k
g.w = n
j.w = e
j.p = e
j.r = n
j.y = a
k.t = j
n.s = a
n.x = g
n.r = j
assert a.t.w.p.y.txt == "a"