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

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

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

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

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

i = A("i")
h = B("h")
g = C("g")
l = D("l")
j = E("j")
f = D("f")
m = A("m")

i.r = h
i.q = j
i.x = j
h.o = m
g.y = i
g.o = i
g.r = j
g.t = j
g.p = j
l.u = i
l.o = f
l.p = m
j.r = l
f.u = i
f.o = l
f.p = m
m.r = h
m.q = j
m.x = j
assert m.x.r.o.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

i = A("i")
h = B("h")
g = C("g")
l = D("l")
j = E("j")
f = D("f")
m = A("m")

i.r = h
i.q = j
i.x = j
h.o = m
g.y = i
g.o = i
g.r = j
g.t = j
g.p = j
l.u = i
l.o = f
l.p = m
j.r = l
f.u = i
f.o = l
f.p = m
m.r = h
m.q = j
m.x = j
assert m.x.r.o.u.r.txt == "h"