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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.u: E = None
        self.y: C = None
        self.z: B = None
        self.txt = txt

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

d = A("d")
i = B("i")
g = C("g")
m = D("m")
l = E("l")
k = A("k")
b = B("b")

d.w = i
d.r = k
d.z = g
i.s = k
g.v = b
g.q = m
g.u = k
m.t = i
m.z = i
m.v = d
m.u = l
m.y = g
l.z = i
l.q = g
l.x = m
k.w = i
k.r = d
k.z = g
b.s = d
assert k.r.w.s.z.u.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: A = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.u: E = None
        self.y: C = None
        self.z: B = None
        self.txt = txt

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

d = A("d")
i = B("i")
g = C("g")
m = D("m")
l = E("l")
k = A("k")
b = B("b")

d.w = i
d.r = k
d.z = g
i.s = k
g.v = b
g.q = m
g.u = k
m.t = i
m.z = i
m.v = d
m.u = l
m.y = g
l.z = i
l.q = g
l.x = m
k.w = i
k.r = d
k.z = g
b.s = d
assert k.r.w.s.z.u.r.z.txt == "g"