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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: D = None
        self.r: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: D = None
        self.r: C = None
        self.t: B = None
        self.txt = txt

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

h.y = m
h.r = m
a.s = c
a.z = c
a.q = m
a.o = h
g.x = j
g.q = h
g.o = k
c.r = m
c.q = j
k.x = j
k.p = c
k.r = g
k.t = a
l.y = m
l.r = m
m.x = a
m.p = c
m.r = g
m.t = j
f.y = k
f.r = m
j.s = c
j.z = c
j.q = k
j.o = f
assert g.o.t.o.y.t.o.r.p.r.txt == "m"