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

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

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

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

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

b = A("b")
n = B("n")
j = C("j")
g = D("g")
f = E("f")
e = A("e")
k = C("k")
a = E("a")
c = B("c")

b.y = e
b.r = c
b.z = g
n.x = c
n.t = a
j.s = g
j.w = g
j.r = a
j.z = a
g.w = b
g.y = n
f.w = c
f.y = a
f.s = g
f.x = e
e.y = b
e.r = c
e.z = g
k.s = g
k.w = g
k.r = a
k.z = a
a.w = n
a.y = f
a.s = g
a.x = b
c.x = n
c.t = a
assert n.x.t.w.x.x.t.x.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
j = C("j")
g = D("g")
f = E("f")
e = A("e")
k = C("k")
a = E("a")
c = B("c")

b.y = e
b.r = c
b.z = g
n.x = c
n.t = a
j.s = g
j.w = g
j.r = a
j.z = a
g.w = b
g.y = n
f.w = c
f.y = a
f.s = g
f.x = e
e.y = b
e.r = c
e.z = g
k.s = g
k.w = g
k.r = a
k.z = a
a.w = n
a.y = f
a.s = g
a.x = b
c.x = n
c.t = a
assert n.x.t.w.x.x.t.x.y.z.txt == "g"