class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: C = None
        self.o: A = None
        self.w: C = None
        self.txt = txt

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

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

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

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

i = A("i")
m = B("m")
c = C("c")
g = D("g")
l = E("l")
n = B("n")
d = A("d")

i.r = g
i.q = c
i.w = c
i.o = d
m.v = c
m.p = l
c.u = g
g.x = c
l.u = g
l.s = g
l.v = g
l.r = i
n.v = c
n.p = l
d.r = g
d.q = c
d.w = c
d.o = i
assert m.v.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: C = None
        self.o: A = None
        self.w: C = None
        self.txt = txt

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

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

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

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

i = A("i")
m = B("m")
c = C("c")
g = D("g")
l = E("l")
n = B("n")
d = A("d")

i.r = g
i.q = c
i.w = c
i.o = d
m.v = c
m.p = l
c.u = g
g.x = c
l.u = g
l.s = g
l.v = g
l.r = i
n.v = c
n.p = l
d.r = g
d.q = c
d.w = c
d.o = i
assert m.v.u.x.u.txt == "g"