class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: E = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
j = C("j")
n = D("n")
g = E("g")
l = E("l")
k = B("k")
a = C("a")

b.o = n
b.z = g
m.y = n
m.s = b
m.w = a
m.t = a
m.r = k
j.x = k
n.s = l
n.o = m
n.w = j
g.q = b
l.q = b
k.y = n
k.s = b
k.w = j
k.t = a
k.r = m
a.x = k
assert l.q.z.q.z.q.o.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: E = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
j = C("j")
n = D("n")
g = E("g")
l = E("l")
k = B("k")
a = C("a")

b.o = n
b.z = g
m.y = n
m.s = b
m.w = a
m.t = a
m.r = k
j.x = k
n.s = l
n.o = m
n.w = j
g.q = b
l.q = b
k.y = n
k.s = b
k.w = j
k.t = a
k.r = m
a.x = k
assert l.q.z.q.z.q.o.s.q.txt == "b"