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

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

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

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

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

h = A("h")
c = B("c")
d = C("d")
m = D("m")
j = E("j")
l = B("l")
e = B("e")

h.u = m
h.v = m
h.y = j
c.r = h
c.u = h
c.p = l
c.v = l
c.y = j
d.u = j
m.x = j
m.v = h
m.s = h
j.q = d
l.r = h
l.u = h
l.p = e
l.v = e
l.y = j
e.r = h
e.u = h
e.p = l
e.v = c
e.y = j
assert e.p.u.u.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

h = A("h")
c = B("c")
d = C("d")
m = D("m")
j = E("j")
l = B("l")
e = B("e")

h.u = m
h.v = m
h.y = j
c.r = h
c.u = h
c.p = l
c.v = l
c.y = j
d.u = j
m.x = j
m.v = h
m.s = h
j.q = d
l.r = h
l.u = h
l.p = e
l.v = e
l.y = j
e.r = h
e.u = h
e.p = l
e.v = c
e.y = j
assert e.p.u.u.s.u.s.txt == "h"