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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: A = None
        self.r: C = None
        self.z: A = None
        self.u: A = None
        self.txt = txt

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

g.s = i
g.r = f
k.u = i
k.o = g
k.q = d
i.p = k
i.r = k
d.u = k
d.s = f
d.z = f
d.o = i
f.q = g
f.y = g
f.z = g
f.u = g
f.r = i
assert i.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: A = None
        self.r: C = None
        self.z: A = None
        self.u: A = None
        self.txt = txt

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

g.s = i
g.r = f
k.u = i
k.o = g
k.q = d
i.p = k
i.r = k
d.u = k
d.s = f
d.z = f
d.o = i
f.q = g
f.y = g
f.z = g
f.u = g
f.r = i
assert i.r.u.r.txt == "k"