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

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

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

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

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

n = A("n")
k = B("k")
c = C("c")
g = D("g")
h = E("h")
j = D("j")

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

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

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

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

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

n = A("n")
k = B("k")
c = C("c")
g = D("g")
h = E("h")
j = D("j")

n.x = c
n.s = c
n.w = c
n.y = k
k.t = j
c.r = k
g.x = h
g.s = h
h.x = k
h.z = c
j.x = h
j.s = h
assert g.s.z.r.t.txt == "j"