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

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

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

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

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

g = A("g")
n = B("n")
c = C("c")
h = D("h")
j = E("j")

g.v = j
g.x = j
g.r = n
n.y = c
n.r = j
n.s = h
n.w = h
c.x = j
c.o = h
h.v = n
j.o = n
j.t = n
j.p = n
j.s = h
assert g.x.s.v.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

g = A("g")
n = B("n")
c = C("c")
h = D("h")
j = E("j")

g.v = j
g.x = j
g.r = n
n.y = c
n.r = j
n.s = h
n.w = h
c.x = j
c.o = h
h.v = n
j.o = n
j.t = n
j.p = n
j.s = h
assert g.x.s.v.r.p.txt == "n"