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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: B = None
        self.u: C = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.w: B = None
        self.u: C = None
        self.p: A = None
        self.txt = txt

d = A("d")
n = B("n")
i = C("i")
g = D("g")
h = E("h")

d.v = h
d.o = h
n.q = i
n.r = h
i.y = g
g.w = i
g.u = i
g.v = n
g.q = h
h.x = n
h.w = n
h.r = i
h.u = i
h.p = d
assert g.q.p.v.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: B = None
        self.u: C = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.w: B = None
        self.u: C = None
        self.p: A = None
        self.txt = txt

d = A("d")
n = B("n")
i = C("i")
g = D("g")
h = E("h")

d.v = h
d.o = h
n.q = i
n.r = h
i.y = g
g.w = i
g.u = i
g.v = n
g.q = h
h.x = n
h.w = n
h.r = i
h.u = i
h.p = d
assert g.q.p.v.x.q.txt == "i"