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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

i.o = d
i.y = g
i.q = c
i.u = c
k.z = d
c.v = d
c.o = k
c.r = g
d.z = k
d.x = k
d.p = c
d.u = i
g.t = c
g.s = c
assert g.s.r.s.r.s.txt == "c"