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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: B = None
        self.w: E = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

l.u = g
l.s = a
l.p = f
l.r = i
m.y = a
m.u = c
m.v = c
m.x = l
m.o = f
i.x = l
i.p = h
c.u = f
c.w = f
c.x = a
c.r = a
c.z = h
f.x = h
f.v = l
f.w = g
g.u = l
g.s = m
g.p = f
g.r = h
a.y = m
a.u = c
a.v = c
a.x = g
a.o = f
h.x = l
h.p = i
assert a.x.p.w.s.v.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: B = None
        self.p: E = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: B = None
        self.w: E = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

l.u = g
l.s = a
l.p = f
l.r = i
m.y = a
m.u = c
m.v = c
m.x = l
m.o = f
i.x = l
i.p = h
c.u = f
c.w = f
c.x = a
c.r = a
c.z = h
f.x = h
f.v = l
f.w = g
g.u = l
g.s = m
g.p = f
g.r = h
a.y = m
a.u = c
a.v = c
a.x = g
a.o = f
h.x = l
h.p = i
assert a.x.p.w.s.v.r.y.txt == "m"