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

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

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

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

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

c = A("c")
e = B("e")
k = C("k")
a = D("a")
f = E("f")
h = A("h")
l = E("l")

c.y = k
c.q = l
c.r = a
e.q = k
k.q = h
a.v = k
a.z = e
a.x = c
f.w = a
f.p = a
f.q = k
f.u = k
f.s = h
h.y = k
h.q = l
h.r = a
l.w = a
l.p = a
l.q = k
l.u = k
l.s = h
assert f.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

c = A("c")
e = B("e")
k = C("k")
a = D("a")
f = E("f")
h = A("h")
l = E("l")

c.y = k
c.q = l
c.r = a
e.q = k
k.q = h
a.v = k
a.z = e
a.x = c
f.w = a
f.p = a
f.q = k
f.u = k
f.s = h
h.y = k
h.q = l
h.r = a
l.w = a
l.p = a
l.q = k
l.u = k
l.s = h
assert f.w.z.q.txt == "k"