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

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

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

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

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

n = A("n")
f = B("f")
g = C("g")
e = D("e")
h = E("h")
a = C("a")
m = A("m")
d = A("d")
l = E("l")
c = D("c")

n.t = e
f.x = l
g.t = f
g.r = m
g.p = h
e.u = g
e.x = g
e.t = l
e.y = l
e.p = c
h.v = d
h.r = e
h.x = a
a.t = f
a.r = m
a.p = l
m.t = e
d.t = c
l.v = m
l.r = c
l.x = a
c.u = g
c.x = a
c.t = l
c.y = h
c.p = e
assert m.t.u.t.x.v.t.u.t.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

n = A("n")
f = B("f")
g = C("g")
e = D("e")
h = E("h")
a = C("a")
m = A("m")
d = A("d")
l = E("l")
c = D("c")

n.t = e
f.x = l
g.t = f
g.r = m
g.p = h
e.u = g
e.x = g
e.t = l
e.y = l
e.p = c
h.v = d
h.r = e
h.x = a
a.t = f
a.r = m
a.p = l
m.t = e
d.t = c
l.v = m
l.r = c
l.x = a
c.u = g
c.x = a
c.t = l
c.y = h
c.p = e
assert m.t.u.t.x.v.t.u.t.x.r.txt == "c"