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

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

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

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

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

j = A("j")
g = B("g")
i = C("i")
c = D("c")
b = E("b")

j.s = g
j.z = g
j.r = i
j.v = i
g.s = j
g.u = i
i.q = b
i.z = c
c.v = g
c.r = g
c.s = i
b.o = j
b.p = c
assert c.v.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: C = None
        self.v: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
i = C("i")
c = D("c")
b = E("b")

j.s = g
j.z = g
j.r = i
j.v = i
g.s = j
g.u = i
i.q = b
i.z = c
c.v = g
c.r = g
c.s = i
b.o = j
b.p = c
assert c.v.u.q.txt == "b"