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

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

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

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

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

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

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

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

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

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

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

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

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