class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: B = None
        self.v: D = None
        self.q: C = None
        self.p: A = None
        self.txt = txt

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

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

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

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

i = A("i")
l = B("l")
g = C("g")
a = D("a")
d = E("d")
k = A("k")

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

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

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

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

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

i = A("i")
l = B("l")
g = C("g")
a = D("a")
d = E("d")
k = A("k")

i.s = g
i.q = g
i.x = l
i.v = a
i.p = k
l.q = g
l.x = d
g.o = a
g.w = a
g.x = l
g.u = d
a.x = g
a.w = g
a.u = l
a.v = k
d.w = g
k.s = g
k.q = g
k.x = l
k.v = a
k.p = i
assert d.w.w.v.p.q.txt == "g"