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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: D = None
        self.s: A = None
        self.w: D = None
        self.txt = txt

j = A("j")
k = B("k")
m = C("m")
c = D("c")
i = D("i")
d = B("d")
h = D("h")
g = A("g")
n = C("n")
e = D("e")

j.p = i
j.x = g
k.w = g
k.r = j
k.o = n
m.y = k
m.t = k
m.v = k
c.v = m
c.p = i
c.s = j
c.w = e
i.v = m
i.p = h
i.w = h
i.s = g
d.w = g
d.r = g
d.o = n
h.v = m
h.p = c
h.s = g
h.w = e
g.p = e
g.x = j
n.y = d
n.t = d
n.v = k
e.v = n
e.p = c
e.s = g
e.w = i
assert h.v.t.w.p.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: D = None
        self.s: A = None
        self.w: D = None
        self.txt = txt

j = A("j")
k = B("k")
m = C("m")
c = D("c")
i = D("i")
d = B("d")
h = D("h")
g = A("g")
n = C("n")
e = D("e")

j.p = i
j.x = g
k.w = g
k.r = j
k.o = n
m.y = k
m.t = k
m.v = k
c.v = m
c.p = i
c.s = j
c.w = e
i.v = m
i.p = h
i.w = h
i.s = g
d.w = g
d.r = g
d.o = n
h.v = m
h.p = c
h.s = g
h.w = e
g.p = e
g.x = j
n.y = d
n.t = d
n.v = k
e.v = n
e.p = c
e.s = g
e.w = i
assert h.v.t.w.p.s.x.x.txt == "g"