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

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

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

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

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

a = A("a")
d = B("d")
b = C("b")
e = D("e")
k = E("k")
c = C("c")
l = D("l")
g = B("g")

a.s = e
a.q = g
a.y = c
a.r = k
d.x = g
d.u = k
b.o = c
b.q = c
e.u = k
e.z = c
e.x = a
e.s = b
e.y = d
k.q = a
c.o = b
c.q = b
l.u = k
l.z = b
l.x = a
l.s = c
l.y = g
g.x = d
g.u = k
assert e.x.r.q.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: B = None
        self.y: C = None
        self.r: E = None
        self.txt = txt

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

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

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

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

a = A("a")
d = B("d")
b = C("b")
e = D("e")
k = E("k")
c = C("c")
l = D("l")
g = B("g")

a.s = e
a.q = g
a.y = c
a.r = k
d.x = g
d.u = k
b.o = c
b.q = c
e.u = k
e.z = c
e.x = a
e.s = b
e.y = d
k.q = a
c.o = b
c.q = b
l.u = k
l.z = b
l.x = a
l.s = c
l.y = g
g.x = d
g.u = k
assert e.x.r.q.r.q.txt == "a"