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

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

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

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

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

h = A("h")
e = B("e")
j = C("j")
k = D("k")
d = E("d")
b = E("b")

h.y = d
h.w = k
e.r = j
e.s = j
e.o = h
j.u = k
k.r = j
k.y = h
k.x = b
k.u = e
d.w = h
d.s = k
d.q = k
b.w = h
b.s = k
b.q = k
assert b.q.y.w.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

h = A("h")
e = B("e")
j = C("j")
k = D("k")
d = E("d")
b = E("b")

h.y = d
h.w = k
e.r = j
e.s = j
e.o = h
j.u = k
k.r = j
k.y = h
k.x = b
k.u = e
d.w = h
d.s = k
d.q = k
b.w = h
b.s = k
b.q = k
assert b.q.y.w.u.r.u.txt == "k"