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

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

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

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

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

k = A("k")
n = B("n")
m = C("m")
a = D("a")
h = E("h")
l = C("l")
g = C("g")

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

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

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

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

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

k = A("k")
n = B("n")
m = C("m")
a = D("a")
h = E("h")
l = C("l")
g = C("g")

k.x = m
n.s = h
n.r = h
n.t = l
m.w = a
m.t = g
a.z = n
a.r = k
a.v = k
h.w = g
h.x = k
h.y = a
l.w = a
l.t = g
g.w = a
g.t = m
assert h.x.x.t.w.z.t.t.txt == "g"