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

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

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

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

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

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

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

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

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

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

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

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

g.q = h
g.s = k
g.u = e
m.p = c
m.u = c
h.y = j
h.t = f
c.q = k
c.p = f
c.t = h
k.x = h
e.q = h
e.s = k
e.u = g
j.p = c
j.u = c
f.q = h
f.s = k
f.u = e
assert e.q.y.u.p.u.txt == "e"