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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: D = None
        self.t: D = None
        self.q: A = None
        self.o: E = None
        self.txt = txt

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

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

h.q = c
h.s = j
g.t = k
c.u = k
a.w = g
a.p = f
a.t = f
a.q = k
a.o = j
b.v = a
b.x = m
b.y = e
b.r = c
k.q = c
k.s = j
f.w = g
f.p = a
f.t = a
f.q = k
f.o = j
j.v = a
j.x = h
j.y = e
j.r = c
m.q = c
m.s = b
e.v = f
e.x = k
e.y = j
e.r = c
assert k.s.y.r.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: D = None
        self.t: D = None
        self.q: A = None
        self.o: E = None
        self.txt = txt

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

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

h.q = c
h.s = j
g.t = k
c.u = k
a.w = g
a.p = f
a.t = f
a.q = k
a.o = j
b.v = a
b.x = m
b.y = e
b.r = c
k.q = c
k.s = j
f.w = g
f.p = a
f.t = a
f.q = k
f.o = j
j.v = a
j.x = h
j.y = e
j.r = c
m.q = c
m.s = b
e.v = f
e.x = k
e.y = j
e.r = c
assert k.s.y.r.u.s.txt == "j"