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

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

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

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

e = A("e")
b = B("b")
k = C("k")
m = D("m")
l = D("l")
f = B("f")
i = A("i")
h = D("h")
g = C("g")
d = A("d")

e.z = b
e.o = k
b.v = g
b.r = f
k.q = h
k.p = g
k.r = b
k.x = d
m.s = e
m.v = b
l.s = i
l.v = f
f.v = k
f.r = b
i.z = b
i.o = k
h.s = e
h.v = b
g.q = m
g.p = k
g.r = f
g.x = i
d.z = b
d.o = k
assert m.s.z.r.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
k = C("k")
m = D("m")
l = D("l")
f = B("f")
i = A("i")
h = D("h")
g = C("g")
d = A("d")

e.z = b
e.o = k
b.v = g
b.r = f
k.q = h
k.p = g
k.r = b
k.x = d
m.s = e
m.v = b
l.s = i
l.v = f
f.v = k
f.r = b
i.z = b
i.o = k
h.s = e
h.v = b
g.q = m
g.p = k
g.r = f
g.x = i
d.z = b
d.o = k
assert m.s.z.r.v.r.txt == "b"