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

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

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

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

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

i = A("i")
h = B("h")
m = C("m")
k = D("k")
c = E("c")
g = D("g")
b = D("b")
a = C("a")

i.y = g
i.x = a
h.q = c
m.y = h
m.z = h
m.x = b
m.s = a
k.x = g
c.v = h
c.u = i
c.w = k
g.x = b
b.x = k
a.y = h
a.z = h
a.x = k
a.s = m
assert k.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

i = A("i")
h = B("h")
m = C("m")
k = D("k")
c = E("c")
g = D("g")
b = D("b")
a = C("a")

i.y = g
i.x = a
h.q = c
m.y = h
m.z = h
m.x = b
m.s = a
k.x = g
c.v = h
c.u = i
c.w = k
g.x = b
b.x = k
a.y = h
a.z = h
a.x = k
a.s = m
assert k.x.x.x.txt == "k"