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

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

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

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

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

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

c.u = j
j.y = i
j.v = h
k.s = m
k.t = a
k.w = h
k.x = j
k.u = c
a.r = j
a.s = j
a.x = i
a.z = h
a.q = h
m.t = k
i.t = k
h.r = j
h.s = j
h.x = m
h.z = a
h.q = a
assert c.u.v.s.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

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

c.u = j
j.y = i
j.v = h
k.s = m
k.t = a
k.w = h
k.x = j
k.u = c
a.r = j
a.s = j
a.x = i
a.z = h
a.q = h
m.t = k
i.t = k
h.r = j
h.s = j
h.x = m
h.z = a
h.q = a
assert c.u.v.s.v.x.txt == "m"